@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'Ticket', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
41 | + 'toType' => $this->namespace.'Ticket', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'Tickets', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
44 | 44 | 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
45 | 45 | 'resolve' => [$this, 'resolveConnection'], |
@@ -18,43 +18,43 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryTicketsConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * TicketConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Ticket $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Ticket $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * TicketConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Ticket $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Ticket $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'Ticket', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
|
42 | - 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
|
43 | - 'resolve' => [$this, 'resolveConnection'], |
|
44 | - ]; |
|
45 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'Ticket', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace) . 'Tickets', |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryTicketsConnection", |
|
42 | + 'connectionArgs' => DatetimeTicketsConnection::get_connection_args(), |
|
43 | + 'resolve' => [$this, 'resolveConnection'], |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param $entity |
|
50 | - * @param $args |
|
51 | - * @param $context |
|
52 | - * @param $info |
|
53 | - * @return TicketConnectionResolver |
|
54 | - * @throws Exception |
|
55 | - */ |
|
56 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | - { |
|
58 | - return new TicketConnectionResolver($entity, $args, $context, $info); |
|
59 | - } |
|
48 | + /** |
|
49 | + * @param $entity |
|
50 | + * @param $args |
|
51 | + * @param $context |
|
52 | + * @param $info |
|
53 | + * @return TicketConnectionResolver |
|
54 | + * @throws Exception |
|
55 | + */ |
|
56 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
57 | + { |
|
58 | + return new TicketConnectionResolver($entity, $args, $context, $info); |
|
59 | + } |
|
60 | 60 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - $this->setName($this->namespace . 'TicketStatusEnum'); |
|
24 | + $this->setName($this->namespace.'TicketStatusEnum'); |
|
25 | 25 | $this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso')); |
26 | 26 | parent::__construct(); |
27 | 27 | } |
@@ -15,38 +15,38 @@ |
||
15 | 15 | */ |
16 | 16 | class TicketStatusEnum extends EnumBase |
17 | 17 | { |
18 | - /** |
|
19 | - * TicketStatusEnum constructor. |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - $this->setName($this->namespace . 'TicketStatusEnum'); |
|
24 | - $this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso')); |
|
25 | - parent::__construct(); |
|
26 | - } |
|
18 | + /** |
|
19 | + * TicketStatusEnum constructor. |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + $this->setName($this->namespace . 'TicketStatusEnum'); |
|
24 | + $this->setDescription(esc_html__('Whether the ticket is On Sale, Pending, or Expired', 'event_espresso')); |
|
25 | + parent::__construct(); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @return array |
|
31 | - */ |
|
32 | - protected function getValues(): array |
|
33 | - { |
|
34 | - return [ |
|
35 | - 'SOLD_OUT' => [ |
|
36 | - 'value' => EE_Ticket::sold_out, |
|
37 | - ], |
|
38 | - 'EXPIRED' => [ |
|
39 | - 'value' => EE_Ticket::expired, |
|
40 | - ], |
|
41 | - 'ARCHIVED' => [ |
|
42 | - 'value' => EE_Ticket::archived, |
|
43 | - ], |
|
44 | - 'PENDING' => [ |
|
45 | - 'value' => EE_Ticket::pending, |
|
46 | - ], |
|
47 | - 'ONSALE' => [ |
|
48 | - 'value' => EE_Ticket::onsale, |
|
49 | - ], |
|
50 | - ]; |
|
51 | - } |
|
29 | + /** |
|
30 | + * @return array |
|
31 | + */ |
|
32 | + protected function getValues(): array |
|
33 | + { |
|
34 | + return [ |
|
35 | + 'SOLD_OUT' => [ |
|
36 | + 'value' => EE_Ticket::sold_out, |
|
37 | + ], |
|
38 | + 'EXPIRED' => [ |
|
39 | + 'value' => EE_Ticket::expired, |
|
40 | + ], |
|
41 | + 'ARCHIVED' => [ |
|
42 | + 'value' => EE_Ticket::archived, |
|
43 | + ], |
|
44 | + 'PENDING' => [ |
|
45 | + 'value' => EE_Ticket::pending, |
|
46 | + ], |
|
47 | + 'ONSALE' => [ |
|
48 | + 'value' => EE_Ticket::onsale, |
|
49 | + ], |
|
50 | + ]; |
|
51 | + } |
|
52 | 52 | } |
@@ -21,7 +21,7 @@ |
||
21 | 21 | */ |
22 | 22 | public function __construct() |
23 | 23 | { |
24 | - $this->setName($this->namespace . 'DatetimeStatusEnum'); |
|
24 | + $this->setName($this->namespace.'DatetimeStatusEnum'); |
|
25 | 25 | $this->setDescription(esc_html__('Datetime status', 'event_espresso')); |
26 | 26 | parent::__construct(); |
27 | 27 | } |
@@ -15,44 +15,44 @@ |
||
15 | 15 | */ |
16 | 16 | class DatetimeStatusEnum extends EnumBase |
17 | 17 | { |
18 | - /** |
|
19 | - * DatetimeStatusEnum constructor. |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - $this->setName($this->namespace . 'DatetimeStatusEnum'); |
|
24 | - $this->setDescription(esc_html__('Datetime status', 'event_espresso')); |
|
25 | - parent::__construct(); |
|
26 | - } |
|
18 | + /** |
|
19 | + * DatetimeStatusEnum constructor. |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + $this->setName($this->namespace . 'DatetimeStatusEnum'); |
|
24 | + $this->setDescription(esc_html__('Datetime status', 'event_espresso')); |
|
25 | + parent::__construct(); |
|
26 | + } |
|
27 | 27 | |
28 | 28 | |
29 | - /** |
|
30 | - * @return array |
|
31 | - */ |
|
32 | - protected function getValues(): array |
|
33 | - { |
|
34 | - return [ |
|
35 | - 'SOLD_OUT' => [ |
|
36 | - 'value' => EE_Datetime::sold_out, |
|
37 | - ], |
|
38 | - 'ACTIVE' => [ |
|
39 | - 'value' => EE_Datetime::active, |
|
40 | - ], |
|
41 | - 'UPCOMING' => [ |
|
42 | - 'value' => EE_Datetime::upcoming, |
|
43 | - ], |
|
44 | - 'POSTPONED' => [ |
|
45 | - 'value' => EE_Datetime::postponed, |
|
46 | - ], |
|
47 | - 'CANCELLED' => [ |
|
48 | - 'value' => EE_Datetime::cancelled, |
|
49 | - ], |
|
50 | - 'EXPIRED' => [ |
|
51 | - 'value' => EE_Datetime::expired, |
|
52 | - ], |
|
53 | - 'INACTIVE' => [ |
|
54 | - 'value' => EE_Datetime::inactive, |
|
55 | - ], |
|
56 | - ]; |
|
57 | - } |
|
29 | + /** |
|
30 | + * @return array |
|
31 | + */ |
|
32 | + protected function getValues(): array |
|
33 | + { |
|
34 | + return [ |
|
35 | + 'SOLD_OUT' => [ |
|
36 | + 'value' => EE_Datetime::sold_out, |
|
37 | + ], |
|
38 | + 'ACTIVE' => [ |
|
39 | + 'value' => EE_Datetime::active, |
|
40 | + ], |
|
41 | + 'UPCOMING' => [ |
|
42 | + 'value' => EE_Datetime::upcoming, |
|
43 | + ], |
|
44 | + 'POSTPONED' => [ |
|
45 | + 'value' => EE_Datetime::postponed, |
|
46 | + ], |
|
47 | + 'CANCELLED' => [ |
|
48 | + 'value' => EE_Datetime::cancelled, |
|
49 | + ], |
|
50 | + 'EXPIRED' => [ |
|
51 | + 'value' => EE_Datetime::expired, |
|
52 | + ], |
|
53 | + 'INACTIVE' => [ |
|
54 | + 'value' => EE_Datetime::inactive, |
|
55 | + ], |
|
56 | + ]; |
|
57 | + } |
|
58 | 58 | } |
@@ -29,10 +29,10 @@ |
||
29 | 29 | isset($input_settings['validation_error_message']) |
30 | 30 | ? $input_settings['validation_error_message'] |
31 | 31 | : null, |
32 | - '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
32 | + '#'.str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
33 | 33 | ) |
34 | 34 | ); |
35 | 35 | parent::__construct($input_settings); |
36 | - $this->set_html_class($this->html_class() . ' email'); |
|
36 | + $this->set_html_class($this->html_class().' email'); |
|
37 | 37 | } |
38 | 38 | } |
@@ -10,29 +10,29 @@ |
||
10 | 10 | */ |
11 | 11 | class EE_Email_Confirm_Input extends EE_Form_Input_Base |
12 | 12 | { |
13 | - /** |
|
14 | - * @param array $input_settings |
|
15 | - */ |
|
16 | - public function __construct($input_settings = array()) |
|
17 | - { |
|
18 | - $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
19 | - $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
20 | - $this->_add_validation_strategy( |
|
21 | - new EE_Email_Validation_Strategy( |
|
22 | - isset($input_settings['validation_error_message']) |
|
23 | - ? $input_settings['validation_error_message'] |
|
24 | - : null |
|
25 | - ) |
|
26 | - ); |
|
27 | - $this->_add_validation_strategy( |
|
28 | - new EE_Equal_To_Validation_Strategy( |
|
29 | - isset($input_settings['validation_error_message']) |
|
30 | - ? $input_settings['validation_error_message'] |
|
31 | - : null, |
|
32 | - '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
33 | - ) |
|
34 | - ); |
|
35 | - parent::__construct($input_settings); |
|
36 | - $this->set_html_class($this->html_class() . ' email'); |
|
37 | - } |
|
13 | + /** |
|
14 | + * @param array $input_settings |
|
15 | + */ |
|
16 | + public function __construct($input_settings = array()) |
|
17 | + { |
|
18 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
19 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
20 | + $this->_add_validation_strategy( |
|
21 | + new EE_Email_Validation_Strategy( |
|
22 | + isset($input_settings['validation_error_message']) |
|
23 | + ? $input_settings['validation_error_message'] |
|
24 | + : null |
|
25 | + ) |
|
26 | + ); |
|
27 | + $this->_add_validation_strategy( |
|
28 | + new EE_Equal_To_Validation_Strategy( |
|
29 | + isset($input_settings['validation_error_message']) |
|
30 | + ? $input_settings['validation_error_message'] |
|
31 | + : null, |
|
32 | + '#' . str_replace('email_confirm', 'email', $input_settings['html_id']) |
|
33 | + ) |
|
34 | + ); |
|
35 | + parent::__construct($input_settings); |
|
36 | + $this->set_html_class($this->html_class() . ' email'); |
|
37 | + } |
|
38 | 38 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function __construct($validation_error_message = '', $compare_to) |
25 | 25 | { |
26 | - if (! $validation_error_message) { |
|
26 | + if ( ! $validation_error_message) { |
|
27 | 27 | $validation_error_message = apply_filters( |
28 | 28 | 'FHEE__EE_Equal_To_Validation_Strategy____construct__validation_error_message', |
29 | 29 | esc_html__('Fields do not match.', 'event_espresso') |
@@ -15,49 +15,49 @@ |
||
15 | 15 | */ |
16 | 16 | class EE_Equal_To_Validation_Strategy extends EE_Text_Validation_Strategy |
17 | 17 | { |
18 | - protected $_compare_to = null; |
|
19 | - |
|
20 | - |
|
21 | - /** |
|
22 | - * @param string $validation_error_message |
|
23 | - */ |
|
24 | - public function __construct($validation_error_message = '', $compare_to) |
|
25 | - { |
|
26 | - if (! $validation_error_message) { |
|
27 | - $validation_error_message = apply_filters( |
|
28 | - 'FHEE__EE_Equal_To_Validation_Strategy____construct__validation_error_message', |
|
29 | - esc_html__('Fields do not match.', 'event_espresso') |
|
30 | - ); |
|
31 | - } |
|
32 | - parent::__construct($validation_error_message); |
|
33 | - $this->_compare_to = $compare_to; |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * just checks the field isn't blank |
|
40 | - * |
|
41 | - * @param $normalized_value |
|
42 | - * @return bool |
|
43 | - * @throws InvalidArgumentException |
|
44 | - * @throws InvalidInterfaceException |
|
45 | - * @throws InvalidDataTypeException |
|
46 | - * @throws EE_Validation_Error |
|
47 | - */ |
|
48 | - public function validate($normalized_value) |
|
49 | - { |
|
50 | - // No need to be validated |
|
51 | - return true; |
|
52 | - } |
|
53 | - |
|
54 | - |
|
55 | - |
|
56 | - /** |
|
57 | - * @return array |
|
58 | - */ |
|
59 | - public function get_jquery_validation_rule_array() |
|
60 | - { |
|
61 | - return array('equalTo' => $this->_compare_to, 'messages' => array('equalTo' => $this->get_validation_error_message())); |
|
62 | - } |
|
18 | + protected $_compare_to = null; |
|
19 | + |
|
20 | + |
|
21 | + /** |
|
22 | + * @param string $validation_error_message |
|
23 | + */ |
|
24 | + public function __construct($validation_error_message = '', $compare_to) |
|
25 | + { |
|
26 | + if (! $validation_error_message) { |
|
27 | + $validation_error_message = apply_filters( |
|
28 | + 'FHEE__EE_Equal_To_Validation_Strategy____construct__validation_error_message', |
|
29 | + esc_html__('Fields do not match.', 'event_espresso') |
|
30 | + ); |
|
31 | + } |
|
32 | + parent::__construct($validation_error_message); |
|
33 | + $this->_compare_to = $compare_to; |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * just checks the field isn't blank |
|
40 | + * |
|
41 | + * @param $normalized_value |
|
42 | + * @return bool |
|
43 | + * @throws InvalidArgumentException |
|
44 | + * @throws InvalidInterfaceException |
|
45 | + * @throws InvalidDataTypeException |
|
46 | + * @throws EE_Validation_Error |
|
47 | + */ |
|
48 | + public function validate($normalized_value) |
|
49 | + { |
|
50 | + // No need to be validated |
|
51 | + return true; |
|
52 | + } |
|
53 | + |
|
54 | + |
|
55 | + |
|
56 | + /** |
|
57 | + * @return array |
|
58 | + */ |
|
59 | + public function get_jquery_validation_rule_array() |
|
60 | + { |
|
61 | + return array('equalTo' => $this->_compare_to, 'messages' => array('equalTo' => $this->get_validation_error_message())); |
|
62 | + } |
|
63 | 63 | } |
@@ -38,8 +38,8 @@ |
||
38 | 38 | { |
39 | 39 | return [ |
40 | 40 | 'fromType' => 'RootQuery', |
41 | - 'toType' => $this->namespace . 'PriceType', |
|
42 | - 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
41 | + 'toType' => $this->namespace.'PriceType', |
|
42 | + 'fromFieldName' => lcfirst($this->namespace).'PriceTypes', |
|
43 | 43 | 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
44 | 44 | 'resolve' => [$this, 'resolveConnection'], |
45 | 45 | ]; |
@@ -18,42 +18,42 @@ |
||
18 | 18 | */ |
19 | 19 | class RootQueryPriceTypesConnection extends AbstractRootQueryConnection |
20 | 20 | { |
21 | - /** |
|
22 | - * PriceTypeConnection constructor. |
|
23 | - * |
|
24 | - * @param EEM_Price_Type $model |
|
25 | - */ |
|
26 | - public function __construct(EEM_Price_Type $model) |
|
27 | - { |
|
28 | - parent::__construct($model); |
|
29 | - } |
|
21 | + /** |
|
22 | + * PriceTypeConnection constructor. |
|
23 | + * |
|
24 | + * @param EEM_Price_Type $model |
|
25 | + */ |
|
26 | + public function __construct(EEM_Price_Type $model) |
|
27 | + { |
|
28 | + parent::__construct($model); |
|
29 | + } |
|
30 | 30 | |
31 | 31 | |
32 | - /** |
|
33 | - * @return array |
|
34 | - */ |
|
35 | - public function config(): array |
|
36 | - { |
|
37 | - return [ |
|
38 | - 'fromType' => 'RootQuery', |
|
39 | - 'toType' => $this->namespace . 'PriceType', |
|
40 | - 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
41 | - 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
|
42 | - 'resolve' => [$this, 'resolveConnection'], |
|
43 | - ]; |
|
44 | - } |
|
32 | + /** |
|
33 | + * @return array |
|
34 | + */ |
|
35 | + public function config(): array |
|
36 | + { |
|
37 | + return [ |
|
38 | + 'fromType' => 'RootQuery', |
|
39 | + 'toType' => $this->namespace . 'PriceType', |
|
40 | + 'fromFieldName' => lcfirst($this->namespace) . 'PriceTypes', |
|
41 | + 'connectionTypeName' => "{$this->namespace}RootQueryPriceTypesConnection", |
|
42 | + 'resolve' => [$this, 'resolveConnection'], |
|
43 | + ]; |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * @param $entity |
|
49 | - * @param $args |
|
50 | - * @param $context |
|
51 | - * @param $info |
|
52 | - * @return PriceTypeConnectionResolver |
|
53 | - * @throws Exception |
|
54 | - */ |
|
55 | - public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
56 | - { |
|
57 | - return new PriceTypeConnectionResolver($entity, $args, $context, $info); |
|
58 | - } |
|
47 | + /** |
|
48 | + * @param $entity |
|
49 | + * @param $args |
|
50 | + * @param $context |
|
51 | + * @param $info |
|
52 | + * @return PriceTypeConnectionResolver |
|
53 | + * @throws Exception |
|
54 | + */ |
|
55 | + public function getConnectionResolver($entity, $args, $context, $info): AbstractConnectionResolver |
|
56 | + { |
|
57 | + return new PriceTypeConnectionResolver($entity, $args, $context, $info); |
|
58 | + } |
|
59 | 59 | } |
@@ -67,10 +67,10 @@ |
||
67 | 67 | * the model layer. |
68 | 68 | */ |
69 | 69 | foreach ($keys as $key) { |
70 | - if (isset($result[ $key ])) { |
|
71 | - $loadedItems[ $key ] = $result[ $key ]; |
|
70 | + if (isset($result[$key])) { |
|
71 | + $loadedItems[$key] = $result[$key]; |
|
72 | 72 | } else { |
73 | - $loadedItems[ $key ] = null; |
|
73 | + $loadedItems[$key] = null; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | return $loadedItems; |
@@ -15,65 +15,65 @@ |
||
15 | 15 | */ |
16 | 16 | abstract class AbstractLoader extends AbstractDataLoader |
17 | 17 | { |
18 | - protected $primaryKey; |
|
18 | + protected $primaryKey; |
|
19 | 19 | |
20 | - /** |
|
21 | - * @return EEM_Base |
|
22 | - * @throws EE_Error |
|
23 | - * @throws InvalidArgumentException |
|
24 | - * @throws InvalidDataTypeException |
|
25 | - * @throws InvalidInterfaceException |
|
26 | - */ |
|
27 | - abstract protected function getQuery(): EEM_Base; |
|
20 | + /** |
|
21 | + * @return EEM_Base |
|
22 | + * @throws EE_Error |
|
23 | + * @throws InvalidArgumentException |
|
24 | + * @throws InvalidDataTypeException |
|
25 | + * @throws InvalidInterfaceException |
|
26 | + */ |
|
27 | + abstract protected function getQuery(): EEM_Base; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @param array $keys |
|
31 | - * @return array |
|
32 | - */ |
|
33 | - abstract protected function getWhereParams(array $keys): array; |
|
29 | + /** |
|
30 | + * @param array $keys |
|
31 | + * @return array |
|
32 | + */ |
|
33 | + abstract protected function getWhereParams(array $keys): array; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Given array of keys, loads and returns a map consisting of keys from `keys` array and loaded |
|
37 | - * values |
|
38 | - * |
|
39 | - * Note that order of returned values must match exactly the order of keys. |
|
40 | - * If some entry is not available for given key - it must include null for the missing key. |
|
41 | - * |
|
42 | - * For example: |
|
43 | - * loadKeys(['a', 'b', 'c']) -> ['a' => 'value1, 'b' => null, 'c' => 'value3'] |
|
44 | - * |
|
45 | - * @param array $keys |
|
46 | - * |
|
47 | - * @return array |
|
48 | - * @throws Exception |
|
49 | - */ |
|
50 | - public function loadKeys(array $keys): array |
|
51 | - { |
|
52 | - if (empty($keys)) { |
|
53 | - return $keys; |
|
54 | - } |
|
35 | + /** |
|
36 | + * Given array of keys, loads and returns a map consisting of keys from `keys` array and loaded |
|
37 | + * values |
|
38 | + * |
|
39 | + * Note that order of returned values must match exactly the order of keys. |
|
40 | + * If some entry is not available for given key - it must include null for the missing key. |
|
41 | + * |
|
42 | + * For example: |
|
43 | + * loadKeys(['a', 'b', 'c']) -> ['a' => 'value1, 'b' => null, 'c' => 'value3'] |
|
44 | + * |
|
45 | + * @param array $keys |
|
46 | + * |
|
47 | + * @return array |
|
48 | + * @throws Exception |
|
49 | + */ |
|
50 | + public function loadKeys(array $keys): array |
|
51 | + { |
|
52 | + if (empty($keys)) { |
|
53 | + return $keys; |
|
54 | + } |
|
55 | 55 | |
56 | - $args = [ |
|
57 | - $this->getWhereParams($keys), |
|
58 | - ]; |
|
56 | + $args = [ |
|
57 | + $this->getWhereParams($keys), |
|
58 | + ]; |
|
59 | 59 | |
60 | - $query = $this->getQuery(); |
|
61 | - $result = $query->get_all($args); |
|
60 | + $query = $this->getQuery(); |
|
61 | + $result = $query->get_all($args); |
|
62 | 62 | |
63 | - $loadedItems = []; |
|
63 | + $loadedItems = []; |
|
64 | 64 | |
65 | - /** |
|
66 | - * Loop over the items and return an array of loaded items, |
|
67 | - * where the key is the ID and the value is the Object passed through |
|
68 | - * the model layer. |
|
69 | - */ |
|
70 | - foreach ($keys as $key) { |
|
71 | - if (isset($result[ $key ])) { |
|
72 | - $loadedItems[ $key ] = $result[ $key ]; |
|
73 | - } else { |
|
74 | - $loadedItems[ $key ] = null; |
|
75 | - } |
|
76 | - } |
|
77 | - return $loadedItems; |
|
78 | - } |
|
65 | + /** |
|
66 | + * Loop over the items and return an array of loaded items, |
|
67 | + * where the key is the ID and the value is the Object passed through |
|
68 | + * the model layer. |
|
69 | + */ |
|
70 | + foreach ($keys as $key) { |
|
71 | + if (isset($result[ $key ])) { |
|
72 | + $loadedItems[ $key ] = $result[ $key ]; |
|
73 | + } else { |
|
74 | + $loadedItems[ $key ] = null; |
|
75 | + } |
|
76 | + } |
|
77 | + return $loadedItems; |
|
78 | + } |
|
79 | 79 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function __construct() |
24 | 24 | { |
25 | - $this->setName($this->namespace . 'ModelNameEnum'); |
|
25 | + $this->setName($this->namespace.'ModelNameEnum'); |
|
26 | 26 | $this->setDescription(esc_html__('Entity model name', 'event_espresso')); |
27 | 27 | parent::__construct(); |
28 | 28 | } |
@@ -19,34 +19,34 @@ |
||
19 | 19 | */ |
20 | 20 | class ModelNameEnum extends EnumBase |
21 | 21 | { |
22 | - /** |
|
23 | - * ModelNameEnum constructor. |
|
24 | - */ |
|
25 | - public function __construct() |
|
26 | - { |
|
27 | - $this->setName($this->namespace . 'ModelNameEnum'); |
|
28 | - $this->setDescription(esc_html__('Entity model name', 'event_espresso')); |
|
29 | - parent::__construct(); |
|
30 | - } |
|
22 | + /** |
|
23 | + * ModelNameEnum constructor. |
|
24 | + */ |
|
25 | + public function __construct() |
|
26 | + { |
|
27 | + $this->setName($this->namespace . 'ModelNameEnum'); |
|
28 | + $this->setDescription(esc_html__('Entity model name', 'event_espresso')); |
|
29 | + parent::__construct(); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | |
33 | - /** |
|
34 | - * @return array |
|
35 | - * @throws EE_Error |
|
36 | - * @throws ReflectionException |
|
37 | - */ |
|
38 | - protected function getValues(): array |
|
39 | - { |
|
40 | - return [ |
|
41 | - 'DATETIME' => [ |
|
42 | - 'value' => EEM_Datetime::instance()->item_name(), |
|
43 | - ], |
|
44 | - 'TICKET' => [ |
|
45 | - 'value' => EEM_Ticket::instance()->item_name(), |
|
46 | - ], |
|
47 | - 'PRICE' => [ |
|
48 | - 'value' => EEM_Price::instance()->item_name(), |
|
49 | - ], |
|
50 | - ]; |
|
51 | - } |
|
33 | + /** |
|
34 | + * @return array |
|
35 | + * @throws EE_Error |
|
36 | + * @throws ReflectionException |
|
37 | + */ |
|
38 | + protected function getValues(): array |
|
39 | + { |
|
40 | + return [ |
|
41 | + 'DATETIME' => [ |
|
42 | + 'value' => EEM_Datetime::instance()->item_name(), |
|
43 | + ], |
|
44 | + 'TICKET' => [ |
|
45 | + 'value' => EEM_Ticket::instance()->item_name(), |
|
46 | + ], |
|
47 | + 'PRICE' => [ |
|
48 | + 'value' => EEM_Price::instance()->item_name(), |
|
49 | + ], |
|
50 | + ]; |
|
51 | + } |
|
52 | 52 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | */ |
13 | 13 | interface GraphQLDataInterface |
14 | 14 | { |
15 | - /** |
|
16 | - * @param array $where_params |
|
17 | - * @return array|null |
|
18 | - * @since $VID:$ |
|
19 | - */ |
|
20 | - public function getData(array $where_params = []); |
|
15 | + /** |
|
16 | + * @param array $where_params |
|
17 | + * @return array|null |
|
18 | + * @since $VID:$ |
|
19 | + */ |
|
20 | + public function getData(array $where_params = []); |
|
21 | 21 | } |