@@ -6,27 +6,27 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInit1bf0023e82df98e9965e078c6e62e256 |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
9 | + public static $prefixLengthsPsr4 = array( |
|
10 | 10 | 'W' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'Wordlift\\Modules\\Dashboard\\' => 27, |
13 | 13 | ), |
14 | 14 | ); |
15 | 15 | |
16 | - public static $prefixDirsPsr4 = array ( |
|
16 | + public static $prefixDirsPsr4 = array( |
|
17 | 17 | 'Wordlift\\Modules\\Dashboard\\' => |
18 | - array ( |
|
19 | - 0 => __DIR__ . '/../..' . '/includes', |
|
18 | + array( |
|
19 | + 0 => __DIR__.'/../..'.'/includes', |
|
20 | 20 | ), |
21 | 21 | ); |
22 | 22 | |
23 | - public static $classMap = array ( |
|
24 | - 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
|
23 | + public static $classMap = array( |
|
24 | + 'Composer\\InstalledVersions' => __DIR__.'/..'.'/composer/InstalledVersions.php', |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | public static function getInitializer(ClassLoader $loader) |
28 | 28 | { |
29 | - return \Closure::bind(function () use ($loader) { |
|
29 | + return \Closure::bind(function() use ($loader) { |
|
30 | 30 | $loader->prefixLengthsPsr4 = ComposerStaticInit1bf0023e82df98e9965e078c6e62e256::$prefixLengthsPsr4; |
31 | 31 | $loader->prefixDirsPsr4 = ComposerStaticInit1bf0023e82df98e9965e078c6e62e256::$prefixDirsPsr4; |
32 | 32 | $loader->classMap = ComposerStaticInit1bf0023e82df98e9965e078c6e62e256::$classMap; |
@@ -6,5 +6,5 @@ |
||
6 | 6 | $baseDir = dirname($vendorDir); |
7 | 7 | |
8 | 8 | return array( |
9 | - 'Wordlift\\Modules\\Dashboard\\' => array($baseDir . '/includes'), |
|
9 | + 'Wordlift\\Modules\\Dashboard\\' => array($baseDir.'/includes'), |
|
10 | 10 | ); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | public static function loadClassLoader($class) |
10 | 10 | { |
11 | 11 | if ('Composer\Autoload\ClassLoader' === $class) { |
12 | - require __DIR__ . '/ClassLoader.php'; |
|
12 | + require __DIR__.'/ClassLoader.php'; |
|
13 | 13 | } |
14 | 14 | } |
15 | 15 | |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | return self::$loader; |
23 | 23 | } |
24 | 24 | |
25 | - require __DIR__ . '/platform_check.php'; |
|
25 | + require __DIR__.'/platform_check.php'; |
|
26 | 26 | |
27 | 27 | spl_autoload_register(array('ComposerAutoloaderInit1bf0023e82df98e9965e078c6e62e256', 'loadClassLoader'), true, true); |
28 | 28 | self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); |
29 | 29 | spl_autoload_unregister(array('ComposerAutoloaderInit1bf0023e82df98e9965e078c6e62e256', 'loadClassLoader')); |
30 | 30 | |
31 | - require __DIR__ . '/autoload_static.php'; |
|
31 | + require __DIR__.'/autoload_static.php'; |
|
32 | 32 | call_user_func(\Composer\Autoload\ComposerStaticInit1bf0023e82df98e9965e078c6e62e256::getInitializer($loader)); |
33 | 33 | |
34 | 34 | $loader->register(true); |
@@ -6,43 +6,43 @@ |
||
6 | 6 | |
7 | 7 | class Stats_Settings implements JsonSerializable { |
8 | 8 | |
9 | - private $description; |
|
10 | - private $title; |
|
11 | - private $label; |
|
12 | - private $color; |
|
13 | - private $show_all_link; |
|
14 | - private $total; |
|
15 | - private $lifted; |
|
9 | + private $description; |
|
10 | + private $title; |
|
11 | + private $label; |
|
12 | + private $color; |
|
13 | + private $show_all_link; |
|
14 | + private $total; |
|
15 | + private $lifted; |
|
16 | 16 | |
17 | - /** |
|
18 | - * @param $description |
|
19 | - * @param $title |
|
20 | - * @param $label |
|
21 | - * @param $color |
|
22 | - * @param $show_all_link |
|
23 | - * @param $total |
|
24 | - * @param $lifted |
|
25 | - */ |
|
26 | - public function __construct( $description, $title, $label, $color, $show_all_link, $total, $lifted ) { |
|
27 | - $this->description = $description; |
|
28 | - $this->title = $title; |
|
29 | - $this->label = $label; |
|
30 | - $this->color = $color; |
|
31 | - $this->show_all_link = $show_all_link; |
|
32 | - $this->total = $total; |
|
33 | - $this->lifted = $lifted; |
|
34 | - } |
|
17 | + /** |
|
18 | + * @param $description |
|
19 | + * @param $title |
|
20 | + * @param $label |
|
21 | + * @param $color |
|
22 | + * @param $show_all_link |
|
23 | + * @param $total |
|
24 | + * @param $lifted |
|
25 | + */ |
|
26 | + public function __construct( $description, $title, $label, $color, $show_all_link, $total, $lifted ) { |
|
27 | + $this->description = $description; |
|
28 | + $this->title = $title; |
|
29 | + $this->label = $label; |
|
30 | + $this->color = $color; |
|
31 | + $this->show_all_link = $show_all_link; |
|
32 | + $this->total = $total; |
|
33 | + $this->lifted = $lifted; |
|
34 | + } |
|
35 | 35 | |
36 | - public function jsonSerialize() { |
|
37 | - return array( |
|
38 | - 'description' => $this->description, |
|
39 | - 'title' => $this->title, |
|
40 | - 'label' => $this->label, |
|
41 | - 'color' => $this->color, |
|
42 | - 'show_all_link' => $this->show_all_link, |
|
43 | - 'total' => $this->total, |
|
44 | - 'lifted' => $this->lifted, |
|
45 | - ); |
|
46 | - } |
|
36 | + public function jsonSerialize() { |
|
37 | + return array( |
|
38 | + 'description' => $this->description, |
|
39 | + 'title' => $this->title, |
|
40 | + 'label' => $this->label, |
|
41 | + 'color' => $this->color, |
|
42 | + 'show_all_link' => $this->show_all_link, |
|
43 | + 'total' => $this->total, |
|
44 | + 'lifted' => $this->lifted, |
|
45 | + ); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @param $total |
24 | 24 | * @param $lifted |
25 | 25 | */ |
26 | - public function __construct( $description, $title, $label, $color, $show_all_link, $total, $lifted ) { |
|
26 | + public function __construct($description, $title, $label, $color, $show_all_link, $total, $lifted) { |
|
27 | 27 | $this->description = $description; |
28 | 28 | $this->title = $title; |
29 | 29 | $this->label = $label; |
@@ -6,27 +6,27 @@ discard block |
||
6 | 6 | |
7 | 7 | class Stats { |
8 | 8 | |
9 | - public function taxonomy( $taxonomy ) { |
|
10 | - return $this->get( Object_Type_Enum::TERM, $taxonomy ); |
|
11 | - } |
|
9 | + public function taxonomy( $taxonomy ) { |
|
10 | + return $this->get( Object_Type_Enum::TERM, $taxonomy ); |
|
11 | + } |
|
12 | 12 | |
13 | - public function post_type( $post_type ) { |
|
14 | - return $this->get( Object_Type_Enum::POST, $post_type ); |
|
15 | - } |
|
13 | + public function post_type( $post_type ) { |
|
14 | + return $this->get( Object_Type_Enum::POST, $post_type ); |
|
15 | + } |
|
16 | 16 | |
17 | - /** |
|
18 | - * @param $type int |
|
19 | - * @param $identifier string |
|
20 | - * |
|
21 | - * @return array() |
|
22 | - */ |
|
23 | - private function get( $type, $identifier ) { |
|
24 | - global $wpdb; |
|
17 | + /** |
|
18 | + * @param $type int |
|
19 | + * @param $identifier string |
|
20 | + * |
|
21 | + * @return array() |
|
22 | + */ |
|
23 | + private function get( $type, $identifier ) { |
|
24 | + global $wpdb; |
|
25 | 25 | |
26 | - if ( $type === Object_Type_Enum::TERM ) { |
|
27 | - return $wpdb->get_row( |
|
28 | - $wpdb->prepare( |
|
29 | - " |
|
26 | + if ( $type === Object_Type_Enum::TERM ) { |
|
27 | + return $wpdb->get_row( |
|
28 | + $wpdb->prepare( |
|
29 | + " |
|
30 | 30 | SELECT COUNT(1) as total, COUNT(e.about_jsonld) AS lifted |
31 | 31 | FROM {$wpdb->prefix}terms t |
32 | 32 | INNER JOIN {$wpdb->prefix}term_taxonomy tt |
@@ -35,31 +35,31 @@ discard block |
||
35 | 35 | ON e.content_id = t.term_id |
36 | 36 | WHERE e.content_type = %d AND tt.taxonomy = %s |
37 | 37 | ", |
38 | - $type, |
|
39 | - $identifier |
|
40 | - ), |
|
41 | - ARRAY_A |
|
42 | - ); |
|
43 | - } |
|
38 | + $type, |
|
39 | + $identifier |
|
40 | + ), |
|
41 | + ARRAY_A |
|
42 | + ); |
|
43 | + } |
|
44 | 44 | |
45 | - if ( $type === Object_Type_Enum::POST ) { |
|
46 | - return $wpdb->get_row( |
|
47 | - $wpdb->prepare( |
|
48 | - " |
|
45 | + if ( $type === Object_Type_Enum::POST ) { |
|
46 | + return $wpdb->get_row( |
|
47 | + $wpdb->prepare( |
|
48 | + " |
|
49 | 49 | SELECT COUNT(1) AS total, COUNT(e.about_jsonld) as lifted |
50 | 50 | FROM {$wpdb->prefix}posts p |
51 | 51 | LEFT JOIN {$wpdb->prefix}wl_entities e |
52 | 52 | ON e.content_id = p.ID |
53 | 53 | WHERE e.content_type = %d AND p.post_type = %s |
54 | 54 | ", |
55 | - $type, |
|
56 | - $identifier |
|
57 | - ), |
|
58 | - ARRAY_A |
|
59 | - ); |
|
60 | - } |
|
55 | + $type, |
|
56 | + $identifier |
|
57 | + ), |
|
58 | + ARRAY_A |
|
59 | + ); |
|
60 | + } |
|
61 | 61 | |
62 | - return null; |
|
63 | - } |
|
62 | + return null; |
|
63 | + } |
|
64 | 64 | |
65 | 65 | } |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | |
7 | 7 | class Stats { |
8 | 8 | |
9 | - public function taxonomy( $taxonomy ) { |
|
10 | - return $this->get( Object_Type_Enum::TERM, $taxonomy ); |
|
9 | + public function taxonomy($taxonomy) { |
|
10 | + return $this->get(Object_Type_Enum::TERM, $taxonomy); |
|
11 | 11 | } |
12 | 12 | |
13 | - public function post_type( $post_type ) { |
|
14 | - return $this->get( Object_Type_Enum::POST, $post_type ); |
|
13 | + public function post_type($post_type) { |
|
14 | + return $this->get(Object_Type_Enum::POST, $post_type); |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | /** |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return array() |
22 | 22 | */ |
23 | - private function get( $type, $identifier ) { |
|
23 | + private function get($type, $identifier) { |
|
24 | 24 | global $wpdb; |
25 | 25 | |
26 | - if ( $type === Object_Type_Enum::TERM ) { |
|
26 | + if ($type === Object_Type_Enum::TERM) { |
|
27 | 27 | return $wpdb->get_row( |
28 | 28 | $wpdb->prepare( |
29 | 29 | " |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | ); |
43 | 43 | } |
44 | 44 | |
45 | - if ( $type === Object_Type_Enum::POST ) { |
|
45 | + if ($type === Object_Type_Enum::POST) { |
|
46 | 46 | return $wpdb->get_row( |
47 | 47 | $wpdb->prepare( |
48 | 48 | " |
@@ -7,104 +7,104 @@ |
||
7 | 7 | use Wordlift\Assertions; |
8 | 8 | class Match_Entry implements Serializable, JsonSerializable { |
9 | 9 | |
10 | - private $id; |
|
11 | - private $match_jsonld; |
|
12 | - |
|
13 | - private $name; |
|
14 | - private $match_id; |
|
15 | - |
|
16 | - /** |
|
17 | - * @param $id |
|
18 | - * @param $match_jsonld |
|
19 | - * @param $name |
|
20 | - * @param $match_id |
|
21 | - */ |
|
22 | - public function __construct( $id, $name, $match_jsonld, $match_id ) { |
|
23 | - $this->id = $id; |
|
24 | - $this->match_jsonld = $match_jsonld; |
|
25 | - $this->name = $name; |
|
26 | - $this->match_id = $match_id; |
|
27 | - } |
|
28 | - |
|
29 | - /** |
|
30 | - * @param $data |
|
31 | - * |
|
32 | - * @return void |
|
33 | - * @throws \Exception Throw exception if the validation fails. |
|
34 | - */ |
|
35 | - public static function validate( $data ) { |
|
36 | - Assertions::array_key_exists( $data, 'match_id' ); |
|
37 | - Assertions::array_key_exists( $data, 'match_jsonld' ); |
|
38 | - Assertions::array_key_exists( $data, 'name' ); |
|
39 | - Assertions::array_key_exists( $data, 'id' ); |
|
40 | - } |
|
41 | - |
|
42 | - public function __serialize() { |
|
43 | - return array( |
|
44 | - 'id' => $this->id, |
|
45 | - |
|
46 | - 'match_jsonld' => $this->match_jsonld, |
|
47 | - 'name' => $this->name, |
|
48 | - 'match_id' => $this->match_id, |
|
49 | - 'match_name' => $this->get_name(), |
|
50 | - ); |
|
51 | - } |
|
52 | - |
|
53 | - /** |
|
54 | - * Controls how the object is represented during PHP serialization. |
|
55 | - * |
|
56 | - * @return string The PHP serialized representation of the object. |
|
57 | - */ |
|
58 | - public function serialize() { |
|
59 | - // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize |
|
60 | - return serialize( $this->__serialize() ); |
|
61 | - } |
|
62 | - |
|
63 | - public function unserialize( $data ) { |
|
64 | - // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize |
|
65 | - $this->__unserialize( unserialize( $data ) ); |
|
66 | - } |
|
67 | - |
|
68 | - public function __unserialize( array $data ) { |
|
69 | - self::validate( $data ); |
|
70 | - $this->id = $data['id']; |
|
71 | - $this->name = $data['name']; |
|
72 | - $this->match_jsonld = $data['match_jsonld']; |
|
73 | - $this->match_id = $data['match_id']; |
|
74 | - } |
|
75 | - |
|
76 | - public static function from( $data ) { |
|
77 | - |
|
78 | - self::validate( $data ); |
|
79 | - |
|
80 | - return new Match_Entry( |
|
81 | - $data['id'], |
|
82 | - $data['name'], |
|
83 | - $data['match_jsonld'], |
|
84 | - $data['match_id'] |
|
85 | - ); |
|
86 | - |
|
87 | - } |
|
88 | - |
|
89 | - /** |
|
90 | - * @return void|string |
|
91 | - */ |
|
92 | - private function get_name() { |
|
93 | - $data = json_decode( $this->match_jsonld, true ); |
|
94 | - if ( ! $data || ! array_key_exists( 'name', $data ) ) { |
|
95 | - return null; |
|
96 | - } |
|
97 | - return $data['name']; |
|
98 | - } |
|
99 | - |
|
100 | - public function jsonSerialize() { |
|
101 | - return array( |
|
102 | - 'id' => $this->id, |
|
103 | - 'match_jsonld' => $this->match_jsonld, |
|
104 | - 'name' => $this->name, |
|
105 | - 'match_id' => $this->match_id, |
|
106 | - 'match_name' => $this->get_name(), |
|
107 | - ); |
|
108 | - } |
|
10 | + private $id; |
|
11 | + private $match_jsonld; |
|
12 | + |
|
13 | + private $name; |
|
14 | + private $match_id; |
|
15 | + |
|
16 | + /** |
|
17 | + * @param $id |
|
18 | + * @param $match_jsonld |
|
19 | + * @param $name |
|
20 | + * @param $match_id |
|
21 | + */ |
|
22 | + public function __construct( $id, $name, $match_jsonld, $match_id ) { |
|
23 | + $this->id = $id; |
|
24 | + $this->match_jsonld = $match_jsonld; |
|
25 | + $this->name = $name; |
|
26 | + $this->match_id = $match_id; |
|
27 | + } |
|
28 | + |
|
29 | + /** |
|
30 | + * @param $data |
|
31 | + * |
|
32 | + * @return void |
|
33 | + * @throws \Exception Throw exception if the validation fails. |
|
34 | + */ |
|
35 | + public static function validate( $data ) { |
|
36 | + Assertions::array_key_exists( $data, 'match_id' ); |
|
37 | + Assertions::array_key_exists( $data, 'match_jsonld' ); |
|
38 | + Assertions::array_key_exists( $data, 'name' ); |
|
39 | + Assertions::array_key_exists( $data, 'id' ); |
|
40 | + } |
|
41 | + |
|
42 | + public function __serialize() { |
|
43 | + return array( |
|
44 | + 'id' => $this->id, |
|
45 | + |
|
46 | + 'match_jsonld' => $this->match_jsonld, |
|
47 | + 'name' => $this->name, |
|
48 | + 'match_id' => $this->match_id, |
|
49 | + 'match_name' => $this->get_name(), |
|
50 | + ); |
|
51 | + } |
|
52 | + |
|
53 | + /** |
|
54 | + * Controls how the object is represented during PHP serialization. |
|
55 | + * |
|
56 | + * @return string The PHP serialized representation of the object. |
|
57 | + */ |
|
58 | + public function serialize() { |
|
59 | + // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize |
|
60 | + return serialize( $this->__serialize() ); |
|
61 | + } |
|
62 | + |
|
63 | + public function unserialize( $data ) { |
|
64 | + // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize |
|
65 | + $this->__unserialize( unserialize( $data ) ); |
|
66 | + } |
|
67 | + |
|
68 | + public function __unserialize( array $data ) { |
|
69 | + self::validate( $data ); |
|
70 | + $this->id = $data['id']; |
|
71 | + $this->name = $data['name']; |
|
72 | + $this->match_jsonld = $data['match_jsonld']; |
|
73 | + $this->match_id = $data['match_id']; |
|
74 | + } |
|
75 | + |
|
76 | + public static function from( $data ) { |
|
77 | + |
|
78 | + self::validate( $data ); |
|
79 | + |
|
80 | + return new Match_Entry( |
|
81 | + $data['id'], |
|
82 | + $data['name'], |
|
83 | + $data['match_jsonld'], |
|
84 | + $data['match_id'] |
|
85 | + ); |
|
86 | + |
|
87 | + } |
|
88 | + |
|
89 | + /** |
|
90 | + * @return void|string |
|
91 | + */ |
|
92 | + private function get_name() { |
|
93 | + $data = json_decode( $this->match_jsonld, true ); |
|
94 | + if ( ! $data || ! array_key_exists( 'name', $data ) ) { |
|
95 | + return null; |
|
96 | + } |
|
97 | + return $data['name']; |
|
98 | + } |
|
99 | + |
|
100 | + public function jsonSerialize() { |
|
101 | + return array( |
|
102 | + 'id' => $this->id, |
|
103 | + 'match_jsonld' => $this->match_jsonld, |
|
104 | + 'name' => $this->name, |
|
105 | + 'match_id' => $this->match_id, |
|
106 | + 'match_name' => $this->get_name(), |
|
107 | + ); |
|
108 | + } |
|
109 | 109 | |
110 | 110 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param $name |
20 | 20 | * @param $match_id |
21 | 21 | */ |
22 | - public function __construct( $id, $name, $match_jsonld, $match_id ) { |
|
22 | + public function __construct($id, $name, $match_jsonld, $match_id) { |
|
23 | 23 | $this->id = $id; |
24 | 24 | $this->match_jsonld = $match_jsonld; |
25 | 25 | $this->name = $name; |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | * @return void |
33 | 33 | * @throws \Exception Throw exception if the validation fails. |
34 | 34 | */ |
35 | - public static function validate( $data ) { |
|
36 | - Assertions::array_key_exists( $data, 'match_id' ); |
|
37 | - Assertions::array_key_exists( $data, 'match_jsonld' ); |
|
38 | - Assertions::array_key_exists( $data, 'name' ); |
|
39 | - Assertions::array_key_exists( $data, 'id' ); |
|
35 | + public static function validate($data) { |
|
36 | + Assertions::array_key_exists($data, 'match_id'); |
|
37 | + Assertions::array_key_exists($data, 'match_jsonld'); |
|
38 | + Assertions::array_key_exists($data, 'name'); |
|
39 | + Assertions::array_key_exists($data, 'id'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function __serialize() { |
@@ -57,25 +57,25 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function serialize() { |
59 | 59 | // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize |
60 | - return serialize( $this->__serialize() ); |
|
60 | + return serialize($this->__serialize()); |
|
61 | 61 | } |
62 | 62 | |
63 | - public function unserialize( $data ) { |
|
63 | + public function unserialize($data) { |
|
64 | 64 | // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize |
65 | - $this->__unserialize( unserialize( $data ) ); |
|
65 | + $this->__unserialize(unserialize($data)); |
|
66 | 66 | } |
67 | 67 | |
68 | - public function __unserialize( array $data ) { |
|
69 | - self::validate( $data ); |
|
68 | + public function __unserialize(array $data) { |
|
69 | + self::validate($data); |
|
70 | 70 | $this->id = $data['id']; |
71 | 71 | $this->name = $data['name']; |
72 | 72 | $this->match_jsonld = $data['match_jsonld']; |
73 | 73 | $this->match_id = $data['match_id']; |
74 | 74 | } |
75 | 75 | |
76 | - public static function from( $data ) { |
|
76 | + public static function from($data) { |
|
77 | 77 | |
78 | - self::validate( $data ); |
|
78 | + self::validate($data); |
|
79 | 79 | |
80 | 80 | return new Match_Entry( |
81 | 81 | $data['id'], |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | * @return void|string |
91 | 91 | */ |
92 | 92 | private function get_name() { |
93 | - $data = json_decode( $this->match_jsonld, true ); |
|
94 | - if ( ! $data || ! array_key_exists( 'name', $data ) ) { |
|
93 | + $data = json_decode($this->match_jsonld, true); |
|
94 | + if ( ! $data || ! array_key_exists('name', $data)) { |
|
95 | 95 | return null; |
96 | 96 | } |
97 | 97 | return $data['name']; |
@@ -10,238 +10,238 @@ |
||
10 | 10 | |
11 | 11 | class Synchronization implements Serializable, JsonSerializable { |
12 | 12 | |
13 | - /** |
|
14 | - * @var DateTimeInterface $created_at |
|
15 | - */ |
|
16 | - private $created_at; |
|
17 | - |
|
18 | - /** |
|
19 | - * @var DateTimeInterface $modified_at |
|
20 | - */ |
|
21 | - private $modified_at; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var DateTimeInterface $started_at |
|
25 | - */ |
|
26 | - private $started_at; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var DateTimeInterface $stopped_at |
|
30 | - */ |
|
31 | - private $stopped_at; |
|
32 | - |
|
33 | - private $total; |
|
34 | - private $offset; |
|
35 | - |
|
36 | - private $last_id; |
|
37 | - private $last_runner_idx; |
|
38 | - |
|
39 | - /** |
|
40 | - * @throws Exception when the created at date can't be set. |
|
41 | - */ |
|
42 | - public function __construct() { |
|
43 | - $this->set_created_at( Date_Utils::now_utc() ); |
|
44 | - $this->set_offset( 0 ); |
|
45 | - $this->set_last_runner_idx( 0 ); |
|
46 | - $this->set_last_id( 0 ); |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * @return mixed |
|
51 | - */ |
|
52 | - public function get_created_at() { |
|
53 | - return $this->created_at; |
|
54 | - } |
|
55 | - |
|
56 | - /** |
|
57 | - * @param mixed $created_at |
|
58 | - */ |
|
59 | - public function set_created_at( $created_at ) { |
|
60 | - $this->created_at = $created_at; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * @return mixed |
|
65 | - */ |
|
66 | - public function get_modified_at() { |
|
67 | - return $this->modified_at; |
|
68 | - } |
|
69 | - |
|
70 | - /** |
|
71 | - * @param mixed $modified_at |
|
72 | - */ |
|
73 | - public function set_modified_at( $modified_at ) { |
|
74 | - $this->modified_at = $modified_at; |
|
75 | - } |
|
76 | - |
|
77 | - /** |
|
78 | - * @return mixed |
|
79 | - */ |
|
80 | - public function get_started_at() { |
|
81 | - return $this->started_at; |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * @param mixed $started_at |
|
86 | - * |
|
87 | - * @throws Exception when the modified at date cannot be set. |
|
88 | - */ |
|
89 | - public function set_started_at( $started_at ) { |
|
90 | - $this->started_at = $started_at; |
|
91 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * @return mixed |
|
96 | - */ |
|
97 | - public function get_stopped_at() { |
|
98 | - return $this->stopped_at; |
|
99 | - } |
|
100 | - |
|
101 | - /** |
|
102 | - * @param mixed $stopped_at |
|
103 | - * |
|
104 | - * @throws Exception when the modified at date cannot be set. |
|
105 | - */ |
|
106 | - public function set_stopped_at( $stopped_at ) { |
|
107 | - $this->stopped_at = $stopped_at; |
|
108 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
109 | - } |
|
110 | - |
|
111 | - /** |
|
112 | - * @return int |
|
113 | - */ |
|
114 | - public function get_total() { |
|
115 | - return $this->total; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * @param int $total |
|
120 | - * |
|
121 | - * @throws Exception when the modified at date cannot be set. |
|
122 | - */ |
|
123 | - public function set_total( $total ) { |
|
124 | - $this->total = $total; |
|
125 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * @return mixed |
|
130 | - */ |
|
131 | - public function get_offset() { |
|
132 | - return $this->offset; |
|
133 | - } |
|
134 | - |
|
135 | - /** |
|
136 | - * @param mixed $offset |
|
137 | - * |
|
138 | - * @throws Exception when the modified at date cannot be set. |
|
139 | - */ |
|
140 | - public function set_offset( $offset ) { |
|
141 | - $this->offset = $offset; |
|
142 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
143 | - } |
|
144 | - |
|
145 | - public function get_last_id() { |
|
146 | - return $this->last_id; |
|
147 | - } |
|
148 | - |
|
149 | - public function set_last_id( $last_id ) { |
|
150 | - $this->last_id = $last_id; |
|
151 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
152 | - } |
|
153 | - |
|
154 | - public function get_last_runner_idx() { |
|
155 | - return $this->last_runner_idx; |
|
156 | - } |
|
157 | - |
|
158 | - public function set_last_runner_idx( $last_runner_idx ) { |
|
159 | - $this->last_runner_idx = $last_runner_idx; |
|
160 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
161 | - } |
|
162 | - |
|
163 | - public function is_running() { |
|
164 | - return isset( $this->started_at ) && ! isset( $this->stopped_at ) |
|
165 | - // Timeout after 10 minutes of inactivity. |
|
166 | - && ( Date_Utils::now_utc()->getTimestamp() - $this->modified_at->getTimestamp() < 600 ); |
|
167 | - } |
|
168 | - |
|
169 | - public function __serialize() { |
|
170 | - return array( |
|
171 | - 'created_at' => $this->created_at, |
|
172 | - 'modified_at' => $this->modified_at, |
|
173 | - 'started_at' => $this->started_at, |
|
174 | - 'stopped_at' => $this->stopped_at, |
|
175 | - 'total' => $this->total, |
|
176 | - 'offset' => $this->offset, |
|
177 | - 'last_id' => $this->last_id, |
|
178 | - 'last_runner_idx' => $this->last_runner_idx, |
|
179 | - ); |
|
180 | - } |
|
181 | - |
|
182 | - /** |
|
183 | - * @throws Exception when dates cannot be set. |
|
184 | - */ |
|
185 | - public function __unserialize( array $data ) { |
|
186 | - if ( isset( $data['created_at'] ) ) { |
|
187 | - $this->created_at = $data['created_at']; |
|
188 | - } |
|
189 | - if ( isset( $data['modified_at'] ) ) { |
|
190 | - $this->modified_at = $data['modified_at']; |
|
191 | - } |
|
192 | - if ( isset( $data['started_at'] ) ) { |
|
193 | - $this->started_at = $data['started_at']; |
|
194 | - } |
|
195 | - if ( isset( $data['stopped_at'] ) ) { |
|
196 | - $this->stopped_at = $data['stopped_at']; |
|
197 | - } |
|
198 | - if ( isset( $data['total'] ) ) { |
|
199 | - $this->total = $data['total']; |
|
200 | - } |
|
201 | - if ( isset( $data['offset'] ) ) { |
|
202 | - $this->offset = $data['offset']; |
|
203 | - } |
|
204 | - $this->last_id = isset( $data['last_id'] ) ? $data['last_id'] : 0; |
|
205 | - $this->last_runner_idx = isset( $data['last_runner_idx'] ) ? $data['last_runner_idx'] : 0; |
|
206 | - |
|
207 | - } |
|
208 | - |
|
209 | - /** |
|
210 | - * Controls how the object is represented during PHP serialization. |
|
211 | - * |
|
212 | - * @return string The PHP serialized representation of the object. |
|
213 | - */ |
|
214 | - public function serialize() { |
|
215 | - // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize |
|
216 | - return serialize( $this->__serialize() ); |
|
217 | - } |
|
218 | - |
|
219 | - /** |
|
220 | - * Controls how the object is reconstructed from a PHP serialized representation. |
|
221 | - * |
|
222 | - * @param string $data The PHP serialized representation of the object. |
|
223 | - * |
|
224 | - * @return void |
|
225 | - */ |
|
226 | - public function unserialize( $data ) { |
|
227 | - // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize |
|
228 | - $this->__unserialize( unserialize( $data ) ); |
|
229 | - } |
|
230 | - |
|
231 | - public function jsonSerialize() { |
|
232 | - return array( |
|
233 | - 'created_at' => is_a( $this->created_at, 'DateTimeInterface' ) |
|
234 | - ? date_format( $this->created_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
235 | - 'modified_at' => is_a( $this->modified_at, 'DateTimeInterface' ) |
|
236 | - ? date_format( $this->modified_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
237 | - 'started_at' => is_a( $this->started_at, 'DateTimeInterface' ) |
|
238 | - ? date_format( $this->started_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
239 | - 'stopped_at' => is_a( $this->stopped_at, 'DateTimeInterface' ) |
|
240 | - ? date_format( $this->stopped_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
241 | - 'total' => $this->total, |
|
242 | - 'offset' => $this->offset, |
|
243 | - 'is_running' => $this->is_running(), |
|
244 | - ); |
|
245 | - } |
|
13 | + /** |
|
14 | + * @var DateTimeInterface $created_at |
|
15 | + */ |
|
16 | + private $created_at; |
|
17 | + |
|
18 | + /** |
|
19 | + * @var DateTimeInterface $modified_at |
|
20 | + */ |
|
21 | + private $modified_at; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var DateTimeInterface $started_at |
|
25 | + */ |
|
26 | + private $started_at; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var DateTimeInterface $stopped_at |
|
30 | + */ |
|
31 | + private $stopped_at; |
|
32 | + |
|
33 | + private $total; |
|
34 | + private $offset; |
|
35 | + |
|
36 | + private $last_id; |
|
37 | + private $last_runner_idx; |
|
38 | + |
|
39 | + /** |
|
40 | + * @throws Exception when the created at date can't be set. |
|
41 | + */ |
|
42 | + public function __construct() { |
|
43 | + $this->set_created_at( Date_Utils::now_utc() ); |
|
44 | + $this->set_offset( 0 ); |
|
45 | + $this->set_last_runner_idx( 0 ); |
|
46 | + $this->set_last_id( 0 ); |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * @return mixed |
|
51 | + */ |
|
52 | + public function get_created_at() { |
|
53 | + return $this->created_at; |
|
54 | + } |
|
55 | + |
|
56 | + /** |
|
57 | + * @param mixed $created_at |
|
58 | + */ |
|
59 | + public function set_created_at( $created_at ) { |
|
60 | + $this->created_at = $created_at; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * @return mixed |
|
65 | + */ |
|
66 | + public function get_modified_at() { |
|
67 | + return $this->modified_at; |
|
68 | + } |
|
69 | + |
|
70 | + /** |
|
71 | + * @param mixed $modified_at |
|
72 | + */ |
|
73 | + public function set_modified_at( $modified_at ) { |
|
74 | + $this->modified_at = $modified_at; |
|
75 | + } |
|
76 | + |
|
77 | + /** |
|
78 | + * @return mixed |
|
79 | + */ |
|
80 | + public function get_started_at() { |
|
81 | + return $this->started_at; |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * @param mixed $started_at |
|
86 | + * |
|
87 | + * @throws Exception when the modified at date cannot be set. |
|
88 | + */ |
|
89 | + public function set_started_at( $started_at ) { |
|
90 | + $this->started_at = $started_at; |
|
91 | + $this->set_modified_at( Date_Utils::now_utc() ); |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * @return mixed |
|
96 | + */ |
|
97 | + public function get_stopped_at() { |
|
98 | + return $this->stopped_at; |
|
99 | + } |
|
100 | + |
|
101 | + /** |
|
102 | + * @param mixed $stopped_at |
|
103 | + * |
|
104 | + * @throws Exception when the modified at date cannot be set. |
|
105 | + */ |
|
106 | + public function set_stopped_at( $stopped_at ) { |
|
107 | + $this->stopped_at = $stopped_at; |
|
108 | + $this->set_modified_at( Date_Utils::now_utc() ); |
|
109 | + } |
|
110 | + |
|
111 | + /** |
|
112 | + * @return int |
|
113 | + */ |
|
114 | + public function get_total() { |
|
115 | + return $this->total; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * @param int $total |
|
120 | + * |
|
121 | + * @throws Exception when the modified at date cannot be set. |
|
122 | + */ |
|
123 | + public function set_total( $total ) { |
|
124 | + $this->total = $total; |
|
125 | + $this->set_modified_at( Date_Utils::now_utc() ); |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * @return mixed |
|
130 | + */ |
|
131 | + public function get_offset() { |
|
132 | + return $this->offset; |
|
133 | + } |
|
134 | + |
|
135 | + /** |
|
136 | + * @param mixed $offset |
|
137 | + * |
|
138 | + * @throws Exception when the modified at date cannot be set. |
|
139 | + */ |
|
140 | + public function set_offset( $offset ) { |
|
141 | + $this->offset = $offset; |
|
142 | + $this->set_modified_at( Date_Utils::now_utc() ); |
|
143 | + } |
|
144 | + |
|
145 | + public function get_last_id() { |
|
146 | + return $this->last_id; |
|
147 | + } |
|
148 | + |
|
149 | + public function set_last_id( $last_id ) { |
|
150 | + $this->last_id = $last_id; |
|
151 | + $this->set_modified_at( Date_Utils::now_utc() ); |
|
152 | + } |
|
153 | + |
|
154 | + public function get_last_runner_idx() { |
|
155 | + return $this->last_runner_idx; |
|
156 | + } |
|
157 | + |
|
158 | + public function set_last_runner_idx( $last_runner_idx ) { |
|
159 | + $this->last_runner_idx = $last_runner_idx; |
|
160 | + $this->set_modified_at( Date_Utils::now_utc() ); |
|
161 | + } |
|
162 | + |
|
163 | + public function is_running() { |
|
164 | + return isset( $this->started_at ) && ! isset( $this->stopped_at ) |
|
165 | + // Timeout after 10 minutes of inactivity. |
|
166 | + && ( Date_Utils::now_utc()->getTimestamp() - $this->modified_at->getTimestamp() < 600 ); |
|
167 | + } |
|
168 | + |
|
169 | + public function __serialize() { |
|
170 | + return array( |
|
171 | + 'created_at' => $this->created_at, |
|
172 | + 'modified_at' => $this->modified_at, |
|
173 | + 'started_at' => $this->started_at, |
|
174 | + 'stopped_at' => $this->stopped_at, |
|
175 | + 'total' => $this->total, |
|
176 | + 'offset' => $this->offset, |
|
177 | + 'last_id' => $this->last_id, |
|
178 | + 'last_runner_idx' => $this->last_runner_idx, |
|
179 | + ); |
|
180 | + } |
|
181 | + |
|
182 | + /** |
|
183 | + * @throws Exception when dates cannot be set. |
|
184 | + */ |
|
185 | + public function __unserialize( array $data ) { |
|
186 | + if ( isset( $data['created_at'] ) ) { |
|
187 | + $this->created_at = $data['created_at']; |
|
188 | + } |
|
189 | + if ( isset( $data['modified_at'] ) ) { |
|
190 | + $this->modified_at = $data['modified_at']; |
|
191 | + } |
|
192 | + if ( isset( $data['started_at'] ) ) { |
|
193 | + $this->started_at = $data['started_at']; |
|
194 | + } |
|
195 | + if ( isset( $data['stopped_at'] ) ) { |
|
196 | + $this->stopped_at = $data['stopped_at']; |
|
197 | + } |
|
198 | + if ( isset( $data['total'] ) ) { |
|
199 | + $this->total = $data['total']; |
|
200 | + } |
|
201 | + if ( isset( $data['offset'] ) ) { |
|
202 | + $this->offset = $data['offset']; |
|
203 | + } |
|
204 | + $this->last_id = isset( $data['last_id'] ) ? $data['last_id'] : 0; |
|
205 | + $this->last_runner_idx = isset( $data['last_runner_idx'] ) ? $data['last_runner_idx'] : 0; |
|
206 | + |
|
207 | + } |
|
208 | + |
|
209 | + /** |
|
210 | + * Controls how the object is represented during PHP serialization. |
|
211 | + * |
|
212 | + * @return string The PHP serialized representation of the object. |
|
213 | + */ |
|
214 | + public function serialize() { |
|
215 | + // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize |
|
216 | + return serialize( $this->__serialize() ); |
|
217 | + } |
|
218 | + |
|
219 | + /** |
|
220 | + * Controls how the object is reconstructed from a PHP serialized representation. |
|
221 | + * |
|
222 | + * @param string $data The PHP serialized representation of the object. |
|
223 | + * |
|
224 | + * @return void |
|
225 | + */ |
|
226 | + public function unserialize( $data ) { |
|
227 | + // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize |
|
228 | + $this->__unserialize( unserialize( $data ) ); |
|
229 | + } |
|
230 | + |
|
231 | + public function jsonSerialize() { |
|
232 | + return array( |
|
233 | + 'created_at' => is_a( $this->created_at, 'DateTimeInterface' ) |
|
234 | + ? date_format( $this->created_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
235 | + 'modified_at' => is_a( $this->modified_at, 'DateTimeInterface' ) |
|
236 | + ? date_format( $this->modified_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
237 | + 'started_at' => is_a( $this->started_at, 'DateTimeInterface' ) |
|
238 | + ? date_format( $this->started_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
239 | + 'stopped_at' => is_a( $this->stopped_at, 'DateTimeInterface' ) |
|
240 | + ? date_format( $this->stopped_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
241 | + 'total' => $this->total, |
|
242 | + 'offset' => $this->offset, |
|
243 | + 'is_running' => $this->is_running(), |
|
244 | + ); |
|
245 | + } |
|
246 | 246 | |
247 | 247 | } |
@@ -40,10 +40,10 @@ discard block |
||
40 | 40 | * @throws Exception when the created at date can't be set. |
41 | 41 | */ |
42 | 42 | public function __construct() { |
43 | - $this->set_created_at( Date_Utils::now_utc() ); |
|
44 | - $this->set_offset( 0 ); |
|
45 | - $this->set_last_runner_idx( 0 ); |
|
46 | - $this->set_last_id( 0 ); |
|
43 | + $this->set_created_at(Date_Utils::now_utc()); |
|
44 | + $this->set_offset(0); |
|
45 | + $this->set_last_runner_idx(0); |
|
46 | + $this->set_last_id(0); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * @param mixed $created_at |
58 | 58 | */ |
59 | - public function set_created_at( $created_at ) { |
|
59 | + public function set_created_at($created_at) { |
|
60 | 60 | $this->created_at = $created_at; |
61 | 61 | } |
62 | 62 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | /** |
71 | 71 | * @param mixed $modified_at |
72 | 72 | */ |
73 | - public function set_modified_at( $modified_at ) { |
|
73 | + public function set_modified_at($modified_at) { |
|
74 | 74 | $this->modified_at = $modified_at; |
75 | 75 | } |
76 | 76 | |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @throws Exception when the modified at date cannot be set. |
88 | 88 | */ |
89 | - public function set_started_at( $started_at ) { |
|
89 | + public function set_started_at($started_at) { |
|
90 | 90 | $this->started_at = $started_at; |
91 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
91 | + $this->set_modified_at(Date_Utils::now_utc()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @throws Exception when the modified at date cannot be set. |
105 | 105 | */ |
106 | - public function set_stopped_at( $stopped_at ) { |
|
106 | + public function set_stopped_at($stopped_at) { |
|
107 | 107 | $this->stopped_at = $stopped_at; |
108 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
108 | + $this->set_modified_at(Date_Utils::now_utc()); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @throws Exception when the modified at date cannot be set. |
122 | 122 | */ |
123 | - public function set_total( $total ) { |
|
123 | + public function set_total($total) { |
|
124 | 124 | $this->total = $total; |
125 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
125 | + $this->set_modified_at(Date_Utils::now_utc()); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
@@ -137,33 +137,33 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @throws Exception when the modified at date cannot be set. |
139 | 139 | */ |
140 | - public function set_offset( $offset ) { |
|
140 | + public function set_offset($offset) { |
|
141 | 141 | $this->offset = $offset; |
142 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
142 | + $this->set_modified_at(Date_Utils::now_utc()); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | public function get_last_id() { |
146 | 146 | return $this->last_id; |
147 | 147 | } |
148 | 148 | |
149 | - public function set_last_id( $last_id ) { |
|
149 | + public function set_last_id($last_id) { |
|
150 | 150 | $this->last_id = $last_id; |
151 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
151 | + $this->set_modified_at(Date_Utils::now_utc()); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | public function get_last_runner_idx() { |
155 | 155 | return $this->last_runner_idx; |
156 | 156 | } |
157 | 157 | |
158 | - public function set_last_runner_idx( $last_runner_idx ) { |
|
158 | + public function set_last_runner_idx($last_runner_idx) { |
|
159 | 159 | $this->last_runner_idx = $last_runner_idx; |
160 | - $this->set_modified_at( Date_Utils::now_utc() ); |
|
160 | + $this->set_modified_at(Date_Utils::now_utc()); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | public function is_running() { |
164 | - return isset( $this->started_at ) && ! isset( $this->stopped_at ) |
|
164 | + return isset($this->started_at) && ! isset($this->stopped_at) |
|
165 | 165 | // Timeout after 10 minutes of inactivity. |
166 | - && ( Date_Utils::now_utc()->getTimestamp() - $this->modified_at->getTimestamp() < 600 ); |
|
166 | + && (Date_Utils::now_utc()->getTimestamp() - $this->modified_at->getTimestamp() < 600); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | public function __serialize() { |
@@ -182,27 +182,27 @@ discard block |
||
182 | 182 | /** |
183 | 183 | * @throws Exception when dates cannot be set. |
184 | 184 | */ |
185 | - public function __unserialize( array $data ) { |
|
186 | - if ( isset( $data['created_at'] ) ) { |
|
185 | + public function __unserialize(array $data) { |
|
186 | + if (isset($data['created_at'])) { |
|
187 | 187 | $this->created_at = $data['created_at']; |
188 | 188 | } |
189 | - if ( isset( $data['modified_at'] ) ) { |
|
189 | + if (isset($data['modified_at'])) { |
|
190 | 190 | $this->modified_at = $data['modified_at']; |
191 | 191 | } |
192 | - if ( isset( $data['started_at'] ) ) { |
|
192 | + if (isset($data['started_at'])) { |
|
193 | 193 | $this->started_at = $data['started_at']; |
194 | 194 | } |
195 | - if ( isset( $data['stopped_at'] ) ) { |
|
195 | + if (isset($data['stopped_at'])) { |
|
196 | 196 | $this->stopped_at = $data['stopped_at']; |
197 | 197 | } |
198 | - if ( isset( $data['total'] ) ) { |
|
198 | + if (isset($data['total'])) { |
|
199 | 199 | $this->total = $data['total']; |
200 | 200 | } |
201 | - if ( isset( $data['offset'] ) ) { |
|
201 | + if (isset($data['offset'])) { |
|
202 | 202 | $this->offset = $data['offset']; |
203 | 203 | } |
204 | - $this->last_id = isset( $data['last_id'] ) ? $data['last_id'] : 0; |
|
205 | - $this->last_runner_idx = isset( $data['last_runner_idx'] ) ? $data['last_runner_idx'] : 0; |
|
204 | + $this->last_id = isset($data['last_id']) ? $data['last_id'] : 0; |
|
205 | + $this->last_runner_idx = isset($data['last_runner_idx']) ? $data['last_runner_idx'] : 0; |
|
206 | 206 | |
207 | 207 | } |
208 | 208 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function serialize() { |
215 | 215 | // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_serialize |
216 | - return serialize( $this->__serialize() ); |
|
216 | + return serialize($this->__serialize()); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @return void |
225 | 225 | */ |
226 | - public function unserialize( $data ) { |
|
226 | + public function unserialize($data) { |
|
227 | 227 | // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.serialize_unserialize |
228 | - $this->__unserialize( unserialize( $data ) ); |
|
228 | + $this->__unserialize(unserialize($data)); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | public function jsonSerialize() { |
232 | 232 | return array( |
233 | - 'created_at' => is_a( $this->created_at, 'DateTimeInterface' ) |
|
234 | - ? date_format( $this->created_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
235 | - 'modified_at' => is_a( $this->modified_at, 'DateTimeInterface' ) |
|
236 | - ? date_format( $this->modified_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
237 | - 'started_at' => is_a( $this->started_at, 'DateTimeInterface' ) |
|
238 | - ? date_format( $this->started_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
239 | - 'stopped_at' => is_a( $this->stopped_at, 'DateTimeInterface' ) |
|
240 | - ? date_format( $this->stopped_at, 'Y-m-d\TH:i:s\Z' ) : null, |
|
233 | + 'created_at' => is_a($this->created_at, 'DateTimeInterface') |
|
234 | + ? date_format($this->created_at, 'Y-m-d\TH:i:s\Z') : null, |
|
235 | + 'modified_at' => is_a($this->modified_at, 'DateTimeInterface') |
|
236 | + ? date_format($this->modified_at, 'Y-m-d\TH:i:s\Z') : null, |
|
237 | + 'started_at' => is_a($this->started_at, 'DateTimeInterface') |
|
238 | + ? date_format($this->started_at, 'Y-m-d\TH:i:s\Z') : null, |
|
239 | + 'stopped_at' => is_a($this->stopped_at, 'DateTimeInterface') |
|
240 | + ? date_format($this->stopped_at, 'Y-m-d\TH:i:s\Z') : null, |
|
241 | 241 | 'total' => $this->total, |
242 | 242 | 'offset' => $this->offset, |
243 | 243 | 'is_running' => $this->is_running(), |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use Exception; |
6 | 6 | |
7 | 7 | class SynchronizationNotRunningException extends Exception { |
8 | - public function __construct() { |
|
9 | - $this->message = __( 'A Synchronization is not running', 'wordlift' ); |
|
10 | - } |
|
8 | + public function __construct() { |
|
9 | + $this->message = __( 'A Synchronization is not running', 'wordlift' ); |
|
10 | + } |
|
11 | 11 | } |
@@ -6,6 +6,6 @@ |
||
6 | 6 | |
7 | 7 | class SynchronizationNotRunningException extends Exception { |
8 | 8 | public function __construct() { |
9 | - $this->message = __( 'A Synchronization is not running', 'wordlift' ); |
|
9 | + $this->message = __('A Synchronization is not running', 'wordlift'); |
|
10 | 10 | } |
11 | 11 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | namespace Wordlift\Modules\Dashboard\Synchronization\Exception; |
4 | 4 | |
5 | 5 | class SynchronizationAlreadyRunningException extends \Exception { |
6 | - public function __construct() { |
|
7 | - $this->message = __( 'A Synchronization is already running', 'wordlift' ); |
|
8 | - } |
|
6 | + public function __construct() { |
|
7 | + $this->message = __( 'A Synchronization is already running', 'wordlift' ); |
|
8 | + } |
|
9 | 9 | } |
@@ -4,6 +4,6 @@ |
||
4 | 4 | |
5 | 5 | class SynchronizationAlreadyRunningException extends \Exception { |
6 | 6 | public function __construct() { |
7 | - $this->message = __( 'A Synchronization is already running', 'wordlift' ); |
|
7 | + $this->message = __('A Synchronization is already running', 'wordlift'); |
|
8 | 8 | } |
9 | 9 | } |