@@ -2,41 +2,41 @@ |
||
| 2 | 2 | namespace Intraxia\Jaxion\Contract\Core; |
| 3 | 3 | |
| 4 | 4 | interface Loader { |
| 5 | - /** |
|
| 6 | - * Register all the actions and filters with WordPress. |
|
| 7 | - * |
|
| 8 | - * Loops through all the registered actions/filters and fires add_* for each of |
|
| 9 | - * them respectively. |
|
| 10 | - */ |
|
| 11 | - public function run(); |
|
| 5 | + /** |
|
| 6 | + * Register all the actions and filters with WordPress. |
|
| 7 | + * |
|
| 8 | + * Loops through all the registered actions/filters and fires add_* for each of |
|
| 9 | + * them respectively. |
|
| 10 | + */ |
|
| 11 | + public function run(); |
|
| 12 | 12 | |
| 13 | - /** |
|
| 14 | - * Registers the service's actions with the loader. |
|
| 15 | - * |
|
| 16 | - * Actions retrieved from the service are registered with the Loader. |
|
| 17 | - * When the loader runs, this actions are registered with WordPress. |
|
| 18 | - * |
|
| 19 | - * @param HasActions $service |
|
| 20 | - */ |
|
| 21 | - public function register_actions( HasActions $service ); |
|
| 13 | + /** |
|
| 14 | + * Registers the service's actions with the loader. |
|
| 15 | + * |
|
| 16 | + * Actions retrieved from the service are registered with the Loader. |
|
| 17 | + * When the loader runs, this actions are registered with WordPress. |
|
| 18 | + * |
|
| 19 | + * @param HasActions $service |
|
| 20 | + */ |
|
| 21 | + public function register_actions( HasActions $service ); |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Registers the service's filters with the loader. |
|
| 25 | - * |
|
| 26 | - * Filters retrieved from the service are registered with the Loader. |
|
| 27 | - * When the loader runs, these filters are registered with WordPress. |
|
| 28 | - * |
|
| 29 | - * @param HasFilters $service |
|
| 30 | - */ |
|
| 31 | - public function register_filters( HasFilters $service ); |
|
| 23 | + /** |
|
| 24 | + * Registers the service's filters with the loader. |
|
| 25 | + * |
|
| 26 | + * Filters retrieved from the service are registered with the Loader. |
|
| 27 | + * When the loader runs, these filters are registered with WordPress. |
|
| 28 | + * |
|
| 29 | + * @param HasFilters $service |
|
| 30 | + */ |
|
| 31 | + public function register_filters( HasFilters $service ); |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Registers the service's shortcode with the loader. |
|
| 35 | - * |
|
| 36 | - * Service's method definitions are passed into the add_shortcode hook |
|
| 37 | - * in WordPress to register the shortcode. |
|
| 38 | - * |
|
| 39 | - * @param HasShortcode $service |
|
| 40 | - */ |
|
| 41 | - public function register_shortcode( HasShortcode $service ); |
|
| 33 | + /** |
|
| 34 | + * Registers the service's shortcode with the loader. |
|
| 35 | + * |
|
| 36 | + * Service's method definitions are passed into the add_shortcode hook |
|
| 37 | + * in WordPress to register the shortcode. |
|
| 38 | + * |
|
| 39 | + * @param HasShortcode $service |
|
| 40 | + */ |
|
| 41 | + public function register_shortcode( HasShortcode $service ); |
|
| 42 | 42 | } |
@@ -2,13 +2,13 @@ |
||
| 2 | 2 | namespace Intraxia\Jaxion\Contract\Core; |
| 3 | 3 | |
| 4 | 4 | interface HasFilters { |
| 5 | - /** |
|
| 6 | - * Provides the array of filters the class wants to register with WordPress. |
|
| 7 | - * |
|
| 8 | - * These filters are retrieved by the Loader class and used to register the |
|
| 9 | - * correct service methods with WordPress. |
|
| 10 | - * |
|
| 11 | - * @return array[] |
|
| 12 | - */ |
|
| 13 | - public function filter_hooks(); |
|
| 5 | + /** |
|
| 6 | + * Provides the array of filters the class wants to register with WordPress. |
|
| 7 | + * |
|
| 8 | + * These filters are retrieved by the Loader class and used to register the |
|
| 9 | + * correct service methods with WordPress. |
|
| 10 | + * |
|
| 11 | + * @return array[] |
|
| 12 | + */ |
|
| 13 | + public function filter_hooks(); |
|
| 14 | 14 | } |
@@ -2,13 +2,13 @@ |
||
| 2 | 2 | namespace Intraxia\Jaxion\Contract\Core; |
| 3 | 3 | |
| 4 | 4 | interface ServiceProvider { |
| 5 | - /** |
|
| 6 | - * Register the provider's services on the container. |
|
| 7 | - * |
|
| 8 | - * This method is passed the container to register on, giving the service provider |
|
| 9 | - * an opportunity to register its services on the container in an encapsulated way. |
|
| 10 | - * |
|
| 11 | - * @param Container $container |
|
| 12 | - */ |
|
| 13 | - public function register( Container $container ); |
|
| 5 | + /** |
|
| 6 | + * Register the provider's services on the container. |
|
| 7 | + * |
|
| 8 | + * This method is passed the container to register on, giving the service provider |
|
| 9 | + * an opportunity to register its services on the container in an encapsulated way. |
|
| 10 | + * |
|
| 11 | + * @param Container $container |
|
| 12 | + */ |
|
| 13 | + public function register( Container $container ); |
|
| 14 | 14 | } |
@@ -4,52 +4,52 @@ |
||
| 4 | 4 | use Intraxia\Jaxion\Core\ApplicationNotBootedException; |
| 5 | 5 | |
| 6 | 6 | interface Application { |
| 7 | - /** |
|
| 8 | - * Starts up the Application. |
|
| 9 | - * |
|
| 10 | - * Retrieves the Application's loader instance, and registers all of the Application's |
|
| 11 | - * services with the loader. It loops through its own services, and any services that |
|
| 12 | - * implement the required interface are passed into the loader. It then attaches the |
|
| 13 | - * loader to the required WordPress hook. |
|
| 14 | - */ |
|
| 15 | - public function boot(); |
|
| 7 | + /** |
|
| 8 | + * Starts up the Application. |
|
| 9 | + * |
|
| 10 | + * Retrieves the Application's loader instance, and registers all of the Application's |
|
| 11 | + * services with the loader. It loops through its own services, and any services that |
|
| 12 | + * implement the required interface are passed into the loader. It then attaches the |
|
| 13 | + * loader to the required WordPress hook. |
|
| 14 | + */ |
|
| 15 | + public function boot(); |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Fired on plugin activation. |
|
| 19 | - * |
|
| 20 | - * This function is attached to `register_activation_hook` and is fired when the plugin is |
|
| 21 | - * activated by WordPress. This gives the developer a place to set up any options, |
|
| 22 | - * add any custom tables, or flush rewrite rules, as required. |
|
| 23 | - */ |
|
| 24 | - public function activate(); |
|
| 17 | + /** |
|
| 18 | + * Fired on plugin activation. |
|
| 19 | + * |
|
| 20 | + * This function is attached to `register_activation_hook` and is fired when the plugin is |
|
| 21 | + * activated by WordPress. This gives the developer a place to set up any options, |
|
| 22 | + * add any custom tables, or flush rewrite rules, as required. |
|
| 23 | + */ |
|
| 24 | + public function activate(); |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Fired on plugin deactivation. |
|
| 28 | - * |
|
| 29 | - * This function is attached to `register_deactivation_hook` and is fired when the plugin |
|
| 30 | - * is deactivated by WordPress. This gives the developer a place to clean up anything left |
|
| 31 | - * behind by the plugin. |
|
| 32 | - */ |
|
| 33 | - public function deactivate(); |
|
| 26 | + /** |
|
| 27 | + * Fired on plugin deactivation. |
|
| 28 | + * |
|
| 29 | + * This function is attached to `register_deactivation_hook` and is fired when the plugin |
|
| 30 | + * is deactivated by WordPress. This gives the developer a place to clean up anything left |
|
| 31 | + * behind by the plugin. |
|
| 32 | + */ |
|
| 33 | + public function deactivate(); |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Retrieves the booted Application instance. |
|
| 37 | - * |
|
| 38 | - * If the Application has not yet been booted, an Exception will be thrown. |
|
| 39 | - * |
|
| 40 | - * @return Application |
|
| 41 | - * @throws ApplicationNotBootedException |
|
| 42 | - */ |
|
| 43 | - public static function instance(); |
|
| 35 | + /** |
|
| 36 | + * Retrieves the booted Application instance. |
|
| 37 | + * |
|
| 38 | + * If the Application has not yet been booted, an Exception will be thrown. |
|
| 39 | + * |
|
| 40 | + * @return Application |
|
| 41 | + * @throws ApplicationNotBootedException |
|
| 42 | + */ |
|
| 43 | + public static function instance(); |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Shuts down the booted Application. |
|
| 47 | - * |
|
| 48 | - * If the Application has already been booted, the Application instance |
|
| 49 | - * will be destroyed by assigning it a null value, freeing it from memory. |
|
| 50 | - * However, the service objects will likely remain in memory if they've been |
|
| 51 | - * attached to hooks when this method is called. This function is primarily |
|
| 52 | - * for uniting testing to make sure you can boot a new instance for each test. |
|
| 53 | - */ |
|
| 54 | - public static function shutdown(); |
|
| 45 | + /** |
|
| 46 | + * Shuts down the booted Application. |
|
| 47 | + * |
|
| 48 | + * If the Application has already been booted, the Application instance |
|
| 49 | + * will be destroyed by assigning it a null value, freeing it from memory. |
|
| 50 | + * However, the service objects will likely remain in memory if they've been |
|
| 51 | + * attached to hooks when this method is called. This function is primarily |
|
| 52 | + * for uniting testing to make sure you can boot a new instance for each test. |
|
| 53 | + */ |
|
| 54 | + public static function shutdown(); |
|
| 55 | 55 | } |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | * @subpackage Contract\Axolotl |
| 9 | 9 | */ |
| 10 | 10 | interface UsesWordPressTerm { |
| 11 | - /** |
|
| 12 | - * Returns the taxonomy used by the Model. |
|
| 13 | - * |
|
| 14 | - * @return string |
|
| 15 | - */ |
|
| 16 | - public static function get_taxonomy(); |
|
| 11 | + /** |
|
| 12 | + * Returns the taxonomy used by the Model. |
|
| 13 | + * |
|
| 14 | + * @return string |
|
| 15 | + */ |
|
| 16 | + public static function get_taxonomy(); |
|
| 17 | 17 | } |
@@ -2,10 +2,10 @@ |
||
| 2 | 2 | namespace Intraxia\Jaxion\Contract\Axolotl; |
| 3 | 3 | |
| 4 | 4 | interface Serializes { |
| 5 | - /** |
|
| 6 | - * Serializes the model's public data into an array. |
|
| 7 | - * |
|
| 8 | - * @return array |
|
| 9 | - */ |
|
| 10 | - public function serialize(); |
|
| 5 | + /** |
|
| 6 | + * Serializes the model's public data into an array. |
|
| 7 | + * |
|
| 8 | + * @return array |
|
| 9 | + */ |
|
| 10 | + public function serialize(); |
|
| 11 | 11 | } |
@@ -8,10 +8,10 @@ |
||
| 8 | 8 | * @subpackage Contract\Axolotl |
| 9 | 9 | */ |
| 10 | 10 | interface UsesWordPressPost { |
| 11 | - /** |
|
| 12 | - * Returns the custom post type used by the Model. |
|
| 13 | - * |
|
| 14 | - * @return string |
|
| 15 | - */ |
|
| 16 | - public static function get_post_type(); |
|
| 11 | + /** |
|
| 12 | + * Returns the custom post type used by the Model. |
|
| 13 | + * |
|
| 14 | + * @return string |
|
| 15 | + */ |
|
| 16 | + public static function get_post_type(); |
|
| 17 | 17 | } |
@@ -11,40 +11,40 @@ |
||
| 11 | 11 | * @subpackage Assets |
| 12 | 12 | */ |
| 13 | 13 | class ServiceProvider implements ServiceProviderContract { |
| 14 | - /** |
|
| 15 | - * Container to register with. |
|
| 16 | - * |
|
| 17 | - * @var Container |
|
| 18 | - */ |
|
| 19 | - protected $container; |
|
| 14 | + /** |
|
| 15 | + * Container to register with. |
|
| 16 | + * |
|
| 17 | + * @var Container |
|
| 18 | + */ |
|
| 19 | + protected $container; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * {@inheritDoc} |
|
| 23 | - * |
|
| 24 | - * @param Container $container |
|
| 25 | - */ |
|
| 26 | - public function register( Container $container ) { |
|
| 27 | - $this->container = $container; |
|
| 21 | + /** |
|
| 22 | + * {@inheritDoc} |
|
| 23 | + * |
|
| 24 | + * @param Container $container |
|
| 25 | + */ |
|
| 26 | + public function register( Container $container ) { |
|
| 27 | + $this->container = $container; |
|
| 28 | 28 | |
| 29 | - $container->define( |
|
| 30 | - array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ), |
|
| 31 | - $register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) ) |
|
| 32 | - ); |
|
| 29 | + $container->define( |
|
| 30 | + array( 'assets' => 'Intraxia\Jaxion\Contract\Assets\Register' ), |
|
| 31 | + $register = new Register( $container->fetch( 'url' ), $container->fetch( 'version' ) ) |
|
| 32 | + ); |
|
| 33 | 33 | |
| 34 | - $this->add_assets( $register ); |
|
| 35 | - } |
|
| 34 | + $this->add_assets( $register ); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Registers the assets on the generated Register. |
|
| 39 | - * |
|
| 40 | - * This is a no-op by default by can be overwritten by the implementing developer |
|
| 41 | - * to provide a single, clean location to register their assets. |
|
| 42 | - * |
|
| 43 | - * @param Register $register |
|
| 44 | - * |
|
| 45 | - * @codeCoverageIgnore |
|
| 46 | - */ |
|
| 47 | - protected function add_assets( Register $register ) { |
|
| 48 | - // no-op |
|
| 49 | - } |
|
| 37 | + /** |
|
| 38 | + * Registers the assets on the generated Register. |
|
| 39 | + * |
|
| 40 | + * This is a no-op by default by can be overwritten by the implementing developer |
|
| 41 | + * to provide a single, clean location to register their assets. |
|
| 42 | + * |
|
| 43 | + * @param Register $register |
|
| 44 | + * |
|
| 45 | + * @codeCoverageIgnore |
|
| 46 | + */ |
|
| 47 | + protected function add_assets( Register $register ) { |
|
| 48 | + // no-op |
|
| 49 | + } |
|
| 50 | 50 | } |
@@ -15,109 +15,109 @@ |
||
| 15 | 15 | * @subpackage Core |
| 16 | 16 | */ |
| 17 | 17 | class Loader implements LoaderContract { |
| 18 | - /** |
|
| 19 | - * Array of action hooks to attach. |
|
| 20 | - * |
|
| 21 | - * @var array[] |
|
| 22 | - */ |
|
| 23 | - protected $actions = array(); |
|
| 18 | + /** |
|
| 19 | + * Array of action hooks to attach. |
|
| 20 | + * |
|
| 21 | + * @var array[] |
|
| 22 | + */ |
|
| 23 | + protected $actions = array(); |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Array of filter hooks to attach. |
|
| 27 | - * |
|
| 28 | - * @var array[] |
|
| 29 | - */ |
|
| 30 | - protected $filters = array(); |
|
| 25 | + /** |
|
| 26 | + * Array of filter hooks to attach. |
|
| 27 | + * |
|
| 28 | + * @var array[] |
|
| 29 | + */ |
|
| 30 | + protected $filters = array(); |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * {@inheritDoc} |
|
| 34 | - */ |
|
| 35 | - public function run() { |
|
| 36 | - foreach ( $this->actions as $action ) { |
|
| 37 | - add_action( |
|
| 38 | - $action['hook'], |
|
| 39 | - array( $action['service'], $action['method'] ), |
|
| 40 | - $action['priority'], |
|
| 41 | - $action['args'] |
|
| 42 | - ); |
|
| 43 | - } |
|
| 32 | + /** |
|
| 33 | + * {@inheritDoc} |
|
| 34 | + */ |
|
| 35 | + public function run() { |
|
| 36 | + foreach ( $this->actions as $action ) { |
|
| 37 | + add_action( |
|
| 38 | + $action['hook'], |
|
| 39 | + array( $action['service'], $action['method'] ), |
|
| 40 | + $action['priority'], |
|
| 41 | + $action['args'] |
|
| 42 | + ); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - foreach ( $this->filters as $filter ) { |
|
| 46 | - add_filter( |
|
| 47 | - $filter['hook'], |
|
| 48 | - array( $filter['service'], $filter['method'] ), |
|
| 49 | - $filter['priority'], |
|
| 50 | - $filter['args'] |
|
| 51 | - ); |
|
| 52 | - } |
|
| 53 | - } |
|
| 45 | + foreach ( $this->filters as $filter ) { |
|
| 46 | + add_filter( |
|
| 47 | + $filter['hook'], |
|
| 48 | + array( $filter['service'], $filter['method'] ), |
|
| 49 | + $filter['priority'], |
|
| 50 | + $filter['args'] |
|
| 51 | + ); |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * {@inheritDoc} |
|
| 57 | - * |
|
| 58 | - * @param HasActions $service |
|
| 59 | - */ |
|
| 60 | - public function register_actions( HasActions $service ) { |
|
| 61 | - foreach ( $service->action_hooks() as $action ) { |
|
| 62 | - $this->actions = $this->add( |
|
| 63 | - $this->actions, |
|
| 64 | - $action['hook'], |
|
| 65 | - $service, |
|
| 66 | - $action['method'], |
|
| 67 | - isset( $action['priority'] ) ? $action['priority'] : 10, |
|
| 68 | - isset( $action['args'] ) ? $action['args'] : 1 |
|
| 69 | - ); |
|
| 70 | - } |
|
| 71 | - } |
|
| 55 | + /** |
|
| 56 | + * {@inheritDoc} |
|
| 57 | + * |
|
| 58 | + * @param HasActions $service |
|
| 59 | + */ |
|
| 60 | + public function register_actions( HasActions $service ) { |
|
| 61 | + foreach ( $service->action_hooks() as $action ) { |
|
| 62 | + $this->actions = $this->add( |
|
| 63 | + $this->actions, |
|
| 64 | + $action['hook'], |
|
| 65 | + $service, |
|
| 66 | + $action['method'], |
|
| 67 | + isset( $action['priority'] ) ? $action['priority'] : 10, |
|
| 68 | + isset( $action['args'] ) ? $action['args'] : 1 |
|
| 69 | + ); |
|
| 70 | + } |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * {@inheritDoc} |
|
| 75 | - * |
|
| 76 | - * @param HasFilters $service |
|
| 77 | - */ |
|
| 78 | - public function register_filters( HasFilters $service ) { |
|
| 79 | - foreach ( $service->filter_hooks() as $filter ) { |
|
| 80 | - $this->filters = $this->add( |
|
| 81 | - $this->filters, |
|
| 82 | - $filter['hook'], |
|
| 83 | - $service, |
|
| 84 | - $filter['method'], |
|
| 85 | - isset( $filter['priority'] ) ? $filter['priority'] : 10, |
|
| 86 | - isset( $filter['args'] ) ? $filter['args'] : 1 |
|
| 87 | - ); |
|
| 88 | - } |
|
| 89 | - } |
|
| 73 | + /** |
|
| 74 | + * {@inheritDoc} |
|
| 75 | + * |
|
| 76 | + * @param HasFilters $service |
|
| 77 | + */ |
|
| 78 | + public function register_filters( HasFilters $service ) { |
|
| 79 | + foreach ( $service->filter_hooks() as $filter ) { |
|
| 80 | + $this->filters = $this->add( |
|
| 81 | + $this->filters, |
|
| 82 | + $filter['hook'], |
|
| 83 | + $service, |
|
| 84 | + $filter['method'], |
|
| 85 | + isset( $filter['priority'] ) ? $filter['priority'] : 10, |
|
| 86 | + isset( $filter['args'] ) ? $filter['args'] : 1 |
|
| 87 | + ); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * {@inheritDoc} |
|
| 93 | - * |
|
| 94 | - * @param HasShortcode $service |
|
| 95 | - */ |
|
| 96 | - public function register_shortcode( HasShortcode $service ) { |
|
| 97 | - add_shortcode( $service->shortcode_name(), array( $service, 'do_shortcode' ) ); |
|
| 98 | - } |
|
| 91 | + /** |
|
| 92 | + * {@inheritDoc} |
|
| 93 | + * |
|
| 94 | + * @param HasShortcode $service |
|
| 95 | + */ |
|
| 96 | + public function register_shortcode( HasShortcode $service ) { |
|
| 97 | + add_shortcode( $service->shortcode_name(), array( $service, 'do_shortcode' ) ); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * Utility to register the actions and hooks into a single collection. |
|
| 102 | - * |
|
| 103 | - * @param array $hooks |
|
| 104 | - * @param string $hook |
|
| 105 | - * @param object $service |
|
| 106 | - * @param string $method |
|
| 107 | - * @param int $priority |
|
| 108 | - * @param int $accepted_args |
|
| 109 | - * |
|
| 110 | - * @return array |
|
| 111 | - */ |
|
| 112 | - protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) { |
|
| 113 | - $hooks[] = array( |
|
| 114 | - 'hook' => $hook, |
|
| 115 | - 'service' => $service, |
|
| 116 | - 'method' => $method, |
|
| 117 | - 'priority' => $priority, |
|
| 118 | - 'args' => $accepted_args, |
|
| 119 | - ); |
|
| 100 | + /** |
|
| 101 | + * Utility to register the actions and hooks into a single collection. |
|
| 102 | + * |
|
| 103 | + * @param array $hooks |
|
| 104 | + * @param string $hook |
|
| 105 | + * @param object $service |
|
| 106 | + * @param string $method |
|
| 107 | + * @param int $priority |
|
| 108 | + * @param int $accepted_args |
|
| 109 | + * |
|
| 110 | + * @return array |
|
| 111 | + */ |
|
| 112 | + protected function add( $hooks, $hook, $service, $method, $priority, $accepted_args ) { |
|
| 113 | + $hooks[] = array( |
|
| 114 | + 'hook' => $hook, |
|
| 115 | + 'service' => $service, |
|
| 116 | + 'method' => $method, |
|
| 117 | + 'priority' => $priority, |
|
| 118 | + 'args' => $accepted_args, |
|
| 119 | + ); |
|
| 120 | 120 | |
| 121 | - return $hooks; |
|
| 122 | - } |
|
| 121 | + return $hooks; |
|
| 122 | + } |
|
| 123 | 123 | } |