@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * |
16 | 16 | * @return Response |
17 | 17 | */ |
18 | - public function request( $method, $path, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ); |
|
18 | + public function request($method, $path, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array()); |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @param $path |
@@ -27,6 +27,6 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return Response |
29 | 29 | */ |
30 | - public function get( $path, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ); |
|
30 | + public function get($path, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array()); |
|
31 | 31 | |
32 | 32 | } |
@@ -4,29 +4,29 @@ |
||
4 | 4 | |
5 | 5 | interface Api_Service { |
6 | 6 | |
7 | - /** |
|
8 | - * @param $method |
|
9 | - * @param $path |
|
10 | - * @param array $headers |
|
11 | - * @param null $body |
|
12 | - * @param null $timeout |
|
13 | - * @param null $user_agent |
|
14 | - * @param array $args |
|
15 | - * |
|
16 | - * @return Response |
|
17 | - */ |
|
18 | - public function request( $method, $path, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ); |
|
7 | + /** |
|
8 | + * @param $method |
|
9 | + * @param $path |
|
10 | + * @param array $headers |
|
11 | + * @param null $body |
|
12 | + * @param null $timeout |
|
13 | + * @param null $user_agent |
|
14 | + * @param array $args |
|
15 | + * |
|
16 | + * @return Response |
|
17 | + */ |
|
18 | + public function request( $method, $path, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ); |
|
19 | 19 | |
20 | - /** |
|
21 | - * @param $path |
|
22 | - * @param array $headers |
|
23 | - * @param null $body |
|
24 | - * @param null $timeout |
|
25 | - * @param null $user_agent |
|
26 | - * @param array $args |
|
27 | - * |
|
28 | - * @return Response |
|
29 | - */ |
|
30 | - public function get( $path, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ); |
|
20 | + /** |
|
21 | + * @param $path |
|
22 | + * @param array $headers |
|
23 | + * @param null $body |
|
24 | + * @param null $timeout |
|
25 | + * @param null $user_agent |
|
26 | + * @param array $args |
|
27 | + * |
|
28 | + * @return Response |
|
29 | + */ |
|
30 | + public function get( $path, $headers = array(), $body = null, $timeout = null, $user_agent = null, $args = array() ); |
|
31 | 31 | |
32 | 32 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | * @param $last_update |
20 | 20 | * @param $state |
21 | 21 | */ |
22 | - public function __construct( $state, $started = null, $index = null, $count = null, $last_update = null ) { |
|
22 | + public function __construct($state, $started = null, $index = null, $count = null, $last_update = null) { |
|
23 | 23 | $this->started = $started; |
24 | 24 | $this->index = $index; |
25 | 25 | $this->count = (int) $count; |
@@ -4,27 +4,27 @@ |
||
4 | 4 | |
5 | 5 | class Sync_Background_Process_Info { |
6 | 6 | |
7 | - public $started; |
|
8 | - public $index; |
|
9 | - public $count; |
|
10 | - public $last_update; |
|
11 | - public $state; |
|
7 | + public $started; |
|
8 | + public $index; |
|
9 | + public $count; |
|
10 | + public $last_update; |
|
11 | + public $state; |
|
12 | 12 | |
13 | - /** |
|
14 | - * Sync_Model constructor. |
|
15 | - * |
|
16 | - * @param $started |
|
17 | - * @param $index |
|
18 | - * @param $count |
|
19 | - * @param $last_update |
|
20 | - * @param $state |
|
21 | - */ |
|
22 | - public function __construct( $state, $started = null, $index = null, $count = null, $last_update = null ) { |
|
23 | - $this->started = $started; |
|
24 | - $this->index = $index; |
|
25 | - $this->count = (int) $count; |
|
26 | - $this->last_update = $last_update; |
|
27 | - $this->state = $state; |
|
28 | - } |
|
13 | + /** |
|
14 | + * Sync_Model constructor. |
|
15 | + * |
|
16 | + * @param $started |
|
17 | + * @param $index |
|
18 | + * @param $count |
|
19 | + * @param $last_update |
|
20 | + * @param $state |
|
21 | + */ |
|
22 | + public function __construct( $state, $started = null, $index = null, $count = null, $last_update = null ) { |
|
23 | + $this->started = $started; |
|
24 | + $this->index = $index; |
|
25 | + $this->count = (int) $count; |
|
26 | + $this->last_update = $last_update; |
|
27 | + $this->state = $state; |
|
28 | + } |
|
29 | 29 | |
30 | 30 | } |
@@ -21,9 +21,9 @@ |
||
21 | 21 | * |
22 | 22 | * @return bool |
23 | 23 | */ |
24 | - public static function is_local_entity_uri_exist( $entity_uri_service, $ids ) { |
|
25 | - foreach ( $ids as $id ) { |
|
26 | - if ( $entity_uri_service->is_internal( $id ) ) { |
|
24 | + public static function is_local_entity_uri_exist($entity_uri_service, $ids) { |
|
25 | + foreach ($ids as $id) { |
|
26 | + if ($entity_uri_service->is_internal($id)) { |
|
27 | 27 | return true; |
28 | 28 | } |
29 | 29 | } |
@@ -15,20 +15,20 @@ |
||
15 | 15 | |
16 | 16 | class Post_Entities_Validator { |
17 | 17 | |
18 | - /** |
|
19 | - * @param $entity_uri_service \Wordlift_Entity_Uri_Service |
|
20 | - * @param $ids array<string> An array of entity ids |
|
21 | - * |
|
22 | - * @return bool |
|
23 | - */ |
|
24 | - public static function is_local_entity_uri_exist( $entity_uri_service, $ids ) { |
|
25 | - foreach ( $ids as $id ) { |
|
26 | - if ( $entity_uri_service->is_internal( $id ) ) { |
|
27 | - return true; |
|
28 | - } |
|
29 | - } |
|
18 | + /** |
|
19 | + * @param $entity_uri_service \Wordlift_Entity_Uri_Service |
|
20 | + * @param $ids array<string> An array of entity ids |
|
21 | + * |
|
22 | + * @return bool |
|
23 | + */ |
|
24 | + public static function is_local_entity_uri_exist( $entity_uri_service, $ids ) { |
|
25 | + foreach ( $ids as $id ) { |
|
26 | + if ( $entity_uri_service->is_internal( $id ) ) { |
|
27 | + return true; |
|
28 | + } |
|
29 | + } |
|
30 | 30 | |
31 | - return false; |
|
32 | - } |
|
31 | + return false; |
|
32 | + } |
|
33 | 33 | |
34 | 34 | } |
@@ -21,16 +21,16 @@ |
||
21 | 21 | * |
22 | 22 | * @param $term_count Term_Count |
23 | 23 | */ |
24 | - public function __construct( $term_count ) { |
|
24 | + public function __construct($term_count) { |
|
25 | 25 | $this->term_count = $term_count; |
26 | 26 | } |
27 | 27 | |
28 | 28 | public function get_term_count() { |
29 | - $data = get_transient( self::TRANSIENT_KEY ); |
|
29 | + $data = get_transient(self::TRANSIENT_KEY); |
|
30 | 30 | |
31 | - if ( ! $data ) { |
|
31 | + if ( ! $data) { |
|
32 | 32 | $data = $this->term_count->get_term_count(); |
33 | - set_transient( self::TRANSIENT_KEY, $data, 8 * 60 * 60 ); |
|
33 | + set_transient(self::TRANSIENT_KEY, $data, 8 * 60 * 60); |
|
34 | 34 | |
35 | 35 | return $data; |
36 | 36 | } |
@@ -11,31 +11,31 @@ |
||
11 | 11 | */ |
12 | 12 | class Cached_Term_Count implements Term_Count { |
13 | 13 | |
14 | - const TRANSIENT_KEY = '_wl_vocabulary_term_count_transient'; |
|
15 | - /** |
|
16 | - * @var Term_Count |
|
17 | - */ |
|
18 | - private $term_count; |
|
19 | - |
|
20 | - /** |
|
21 | - * Cached_Term_Count constructor. |
|
22 | - * |
|
23 | - * @param $term_count Term_Count |
|
24 | - */ |
|
25 | - public function __construct( $term_count ) { |
|
26 | - $this->term_count = $term_count; |
|
27 | - } |
|
28 | - |
|
29 | - public function get_term_count() { |
|
30 | - $data = get_transient( self::TRANSIENT_KEY ); |
|
31 | - |
|
32 | - if ( ! $data ) { |
|
33 | - $data = $this->term_count->get_term_count(); |
|
34 | - set_transient( self::TRANSIENT_KEY, $data, 8 * 60 * 60 ); |
|
35 | - |
|
36 | - return $data; |
|
37 | - } |
|
38 | - |
|
39 | - return $data; |
|
40 | - } |
|
14 | + const TRANSIENT_KEY = '_wl_vocabulary_term_count_transient'; |
|
15 | + /** |
|
16 | + * @var Term_Count |
|
17 | + */ |
|
18 | + private $term_count; |
|
19 | + |
|
20 | + /** |
|
21 | + * Cached_Term_Count constructor. |
|
22 | + * |
|
23 | + * @param $term_count Term_Count |
|
24 | + */ |
|
25 | + public function __construct( $term_count ) { |
|
26 | + $this->term_count = $term_count; |
|
27 | + } |
|
28 | + |
|
29 | + public function get_term_count() { |
|
30 | + $data = get_transient( self::TRANSIENT_KEY ); |
|
31 | + |
|
32 | + if ( ! $data ) { |
|
33 | + $data = $this->term_count->get_term_count(); |
|
34 | + set_transient( self::TRANSIENT_KEY, $data, 8 * 60 * 60 ); |
|
35 | + |
|
36 | + return $data; |
|
37 | + } |
|
38 | + |
|
39 | + return $data; |
|
40 | + } |
|
41 | 41 | } |
@@ -4,9 +4,9 @@ |
||
4 | 4 | |
5 | 5 | interface Cache { |
6 | 6 | |
7 | - public function get( $cache_key ); |
|
7 | + public function get($cache_key); |
|
8 | 8 | |
9 | - public function put( $cache_key, $value ); |
|
9 | + public function put($cache_key, $value); |
|
10 | 10 | |
11 | 11 | public function flush_all(); |
12 | 12 |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | interface Cache { |
6 | 6 | |
7 | - public function get( $cache_key ); |
|
7 | + public function get( $cache_key ); |
|
8 | 8 | |
9 | - public function put( $cache_key, $value ); |
|
9 | + public function put( $cache_key, $value ); |
|
10 | 10 | |
11 | - public function flush_all(); |
|
11 | + public function flush_all(); |
|
12 | 12 | |
13 | 13 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @param $default_value bool Default value for the flag, true or false. |
27 | 27 | * @param $callback Callable Callback for the feature. |
28 | 28 | */ |
29 | - public function __construct( $feature_slug, $default_value, $callback ) { |
|
29 | + public function __construct($feature_slug, $default_value, $callback) { |
|
30 | 30 | $this->feature_slug = $feature_slug; |
31 | 31 | $this->default_value = $default_value; |
32 | 32 | $this->callback = $callback; |
@@ -4,32 +4,32 @@ |
||
4 | 4 | |
5 | 5 | class Feature { |
6 | 6 | |
7 | - /** |
|
8 | - * @var string |
|
9 | - */ |
|
10 | - public $feature_slug; |
|
7 | + /** |
|
8 | + * @var string |
|
9 | + */ |
|
10 | + public $feature_slug; |
|
11 | 11 | |
12 | - /** |
|
13 | - * @var bool |
|
14 | - */ |
|
15 | - public $default_value; |
|
12 | + /** |
|
13 | + * @var bool |
|
14 | + */ |
|
15 | + public $default_value; |
|
16 | 16 | |
17 | - /** |
|
18 | - * @var Callable |
|
19 | - */ |
|
20 | - public $callback; |
|
17 | + /** |
|
18 | + * @var Callable |
|
19 | + */ |
|
20 | + public $callback; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Feature constructor. |
|
24 | - * |
|
25 | - * @param $feature_slug string Slug for feature without wl__feature__enable |
|
26 | - * @param $default_value bool Default value for the flag, true or false. |
|
27 | - * @param $callback Callable Callback for the feature. |
|
28 | - */ |
|
29 | - public function __construct( $feature_slug, $default_value, $callback ) { |
|
30 | - $this->feature_slug = $feature_slug; |
|
31 | - $this->default_value = $default_value; |
|
32 | - $this->callback = $callback; |
|
33 | - } |
|
22 | + /** |
|
23 | + * Feature constructor. |
|
24 | + * |
|
25 | + * @param $feature_slug string Slug for feature without wl__feature__enable |
|
26 | + * @param $default_value bool Default value for the flag, true or false. |
|
27 | + * @param $callback Callable Callback for the feature. |
|
28 | + */ |
|
29 | + public function __construct( $feature_slug, $default_value, $callback ) { |
|
30 | + $this->feature_slug = $feature_slug; |
|
31 | + $this->default_value = $default_value; |
|
32 | + $this->callback = $callback; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | } |
@@ -11,11 +11,11 @@ |
||
11 | 11 | |
12 | 12 | public static function get_instance() { |
13 | 13 | $child_class_name = get_called_class(); |
14 | - if ( ! array_key_exists( $child_class_name, self::$instances ) ) { |
|
15 | - self::$instances[ $child_class_name ] = new $child_class_name(); |
|
14 | + if ( ! array_key_exists($child_class_name, self::$instances)) { |
|
15 | + self::$instances[$child_class_name] = new $child_class_name(); |
|
16 | 16 | } |
17 | 17 | |
18 | - return self::$instances[ $child_class_name ]; |
|
18 | + return self::$instances[$child_class_name]; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | } |
@@ -4,18 +4,18 @@ |
||
4 | 4 | |
5 | 5 | abstract class Singleton { |
6 | 6 | |
7 | - public static $instances = array(); |
|
7 | + public static $instances = array(); |
|
8 | 8 | |
9 | - protected function __construct() { |
|
10 | - } |
|
9 | + protected function __construct() { |
|
10 | + } |
|
11 | 11 | |
12 | - public static function get_instance() { |
|
13 | - $child_class_name = get_called_class(); |
|
14 | - if ( ! array_key_exists( $child_class_name, self::$instances ) ) { |
|
15 | - self::$instances[ $child_class_name ] = new $child_class_name(); |
|
16 | - } |
|
12 | + public static function get_instance() { |
|
13 | + $child_class_name = get_called_class(); |
|
14 | + if ( ! array_key_exists( $child_class_name, self::$instances ) ) { |
|
15 | + self::$instances[ $child_class_name ] = new $child_class_name(); |
|
16 | + } |
|
17 | 17 | |
18 | - return self::$instances[ $child_class_name ]; |
|
19 | - } |
|
18 | + return self::$instances[ $child_class_name ]; |
|
19 | + } |
|
20 | 20 | |
21 | 21 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | $this->features_registry->register_feature_from_slug( |
44 | 44 | $this->get_feature_slug(), |
45 | 45 | $this->get_feature_default_value(), |
46 | - array( $this, 'init_all_dependencies' ) |
|
46 | + array($this, 'init_all_dependencies') |
|
47 | 47 | ); |
48 | 48 | |
49 | 49 | } |
@@ -11,42 +11,42 @@ |
||
11 | 11 | use Wordlift\Features\Features_Registry; |
12 | 12 | |
13 | 13 | abstract class Default_Loader implements Loader { |
14 | - /** |
|
15 | - * @var Features_Registry |
|
16 | - */ |
|
17 | - private $features_registry; |
|
18 | - |
|
19 | - /** |
|
20 | - * Default_Loader constructor. |
|
21 | - */ |
|
22 | - public function __construct() { |
|
23 | - $this->features_registry = Features_Registry::get_instance(); |
|
24 | - } |
|
25 | - |
|
26 | - /** |
|
27 | - * Initialize all the dependencies needed by the feature inside this method. |
|
28 | - * |
|
29 | - * @return void |
|
30 | - */ |
|
31 | - abstract public function init_all_dependencies(); |
|
32 | - |
|
33 | - abstract protected function get_feature_slug(); |
|
34 | - |
|
35 | - /** |
|
36 | - * @return bool true if the feature wants to be enabled by default |
|
37 | - */ |
|
38 | - abstract protected function get_feature_default_value(); |
|
39 | - |
|
40 | - /** |
|
41 | - * Register feature to registry. |
|
42 | - */ |
|
43 | - public function init_feature() { |
|
44 | - $this->features_registry->register_feature_from_slug( |
|
45 | - $this->get_feature_slug(), |
|
46 | - $this->get_feature_default_value(), |
|
47 | - array( $this, 'init_all_dependencies' ) |
|
48 | - ); |
|
49 | - |
|
50 | - } |
|
14 | + /** |
|
15 | + * @var Features_Registry |
|
16 | + */ |
|
17 | + private $features_registry; |
|
18 | + |
|
19 | + /** |
|
20 | + * Default_Loader constructor. |
|
21 | + */ |
|
22 | + public function __construct() { |
|
23 | + $this->features_registry = Features_Registry::get_instance(); |
|
24 | + } |
|
25 | + |
|
26 | + /** |
|
27 | + * Initialize all the dependencies needed by the feature inside this method. |
|
28 | + * |
|
29 | + * @return void |
|
30 | + */ |
|
31 | + abstract public function init_all_dependencies(); |
|
32 | + |
|
33 | + abstract protected function get_feature_slug(); |
|
34 | + |
|
35 | + /** |
|
36 | + * @return bool true if the feature wants to be enabled by default |
|
37 | + */ |
|
38 | + abstract protected function get_feature_default_value(); |
|
39 | + |
|
40 | + /** |
|
41 | + * Register feature to registry. |
|
42 | + */ |
|
43 | + public function init_feature() { |
|
44 | + $this->features_registry->register_feature_from_slug( |
|
45 | + $this->get_feature_slug(), |
|
46 | + $this->get_feature_default_value(), |
|
47 | + array( $this, 'init_all_dependencies' ) |
|
48 | + ); |
|
49 | + |
|
50 | + } |
|
51 | 51 | |
52 | 52 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | */ |
13 | 13 | private $video_url; |
14 | 14 | |
15 | - public function __construct( $video_url ) { |
|
15 | + public function __construct($video_url) { |
|
16 | 16 | $this->video_url = $video_url; |
17 | 17 | } |
18 | 18 |
@@ -8,20 +8,20 @@ |
||
8 | 8 | |
9 | 9 | class Default_Embedded_Video implements Embedded_Video { |
10 | 10 | |
11 | - /** |
|
12 | - * @var string The url of the video which got embedded. |
|
13 | - */ |
|
14 | - private $video_url; |
|
11 | + /** |
|
12 | + * @var string The url of the video which got embedded. |
|
13 | + */ |
|
14 | + private $video_url; |
|
15 | 15 | |
16 | - public function __construct( $video_url ) { |
|
17 | - $this->video_url = $video_url; |
|
18 | - } |
|
16 | + public function __construct( $video_url ) { |
|
17 | + $this->video_url = $video_url; |
|
18 | + } |
|
19 | 19 | |
20 | - public function get_api_provider() { |
|
21 | - // TODO: Implement get_api_provider() method. |
|
22 | - } |
|
20 | + public function get_api_provider() { |
|
21 | + // TODO: Implement get_api_provider() method. |
|
22 | + } |
|
23 | 23 | |
24 | - public function get_url() { |
|
25 | - return $this->video_url; |
|
26 | - } |
|
24 | + public function get_url() { |
|
25 | + return $this->video_url; |
|
26 | + } |
|
27 | 27 | } |