-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from talis/ent_518_remove_config_job_job_payload
Remove config from job payload
- Loading branch information
Showing
62 changed files
with
1,819 additions
and
995 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace Tripod; | ||
|
||
class Config implements ITripodConfig | ||
{ | ||
/** | ||
* @var Config | ||
*/ | ||
private static $instance; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private static $config = []; | ||
|
||
/** | ||
* Config should not be instantiated directly: use Config::getInstance() | ||
*/ | ||
private function __construct() | ||
{ | ||
} | ||
|
||
/** | ||
* Since this is a singleton class, use this method to create a new config instance. | ||
* @uses Config::setConfig() Configuration must be set prior to calling this method. To generate a completely new object, set a new config | ||
* @codeCoverageIgnore | ||
* @throws \Tripod\Exceptions\ConfigException | ||
* @return ITripodConfig | ||
*/ | ||
public static function getInstance() | ||
{ | ||
if (!isset(self::$config)) { | ||
throw new \Tripod\Exceptions\ConfigException("Call Config::setConfig() first"); | ||
} | ||
if (!isset(self::$instance)) { | ||
self::$instance = TripodConfigFactory::create(self::$config); | ||
} | ||
return self::$instance; | ||
} | ||
|
||
/** | ||
* Loads the Tripod config into the instance | ||
* | ||
* @return void | ||
*/ | ||
public static function setConfig(array $config) | ||
{ | ||
self::$config = $config; | ||
self::$instance = null; // this will force a reload next time getInstance() is called | ||
} | ||
|
||
/** | ||
* Returns the Tripod config array | ||
* | ||
* @return array | ||
*/ | ||
public static function getConfig() | ||
{ | ||
return self::$config; | ||
} | ||
|
||
/** | ||
* This method was added to allow us to test the getInstance() method | ||
* @codeCoverageIgnore | ||
*/ | ||
public static function destroy() | ||
{ | ||
self::$instance = null; | ||
self::$config = null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Tripod; | ||
|
||
interface ITripodConfig | ||
{ | ||
/** | ||
* Tripod Config instances are singletons, this method gets the existing or instantiates a new one. | ||
* | ||
* @return ITripodConfig | ||
*/ | ||
public static function getInstance(); | ||
|
||
/** | ||
* Loads the Tripod config into the instance | ||
* | ||
* @return void | ||
*/ | ||
public static function setConfig(array $config); | ||
|
||
/** | ||
* Returns the Tripod config array | ||
* | ||
* @return array | ||
*/ | ||
public static function getConfig(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Tripod; | ||
|
||
interface ITripodConfigSerializer | ||
{ | ||
|
||
/** | ||
* This should return an array that self::deserialize() can roundtrip into an Tripod Config object | ||
* | ||
* @return void | ||
*/ | ||
public function serialize(); | ||
|
||
/** | ||
* When given a valid config, returns a Tripod Config object | ||
* | ||
* @param array $config | ||
* @return \Tripod\ITripodConfig | ||
*/ | ||
public static function deserialize(array $config); | ||
} |
Oops, something went wrong.