@@ -37,66 +37,66 @@ |
||
| 37 | 37 | class EventVenuesConnection implements ConnectionInterface |
| 38 | 38 | { |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var EEM_Venue $model |
|
| 42 | - */ |
|
| 43 | - protected $model; |
|
| 40 | + /** |
|
| 41 | + * @var EEM_Venue $model |
|
| 42 | + */ |
|
| 43 | + protected $model; |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * DatetimeConnection constructor. |
|
| 48 | - * |
|
| 49 | - * @param EEM_Venue $model |
|
| 50 | - */ |
|
| 51 | - public function __construct(EEM_Venue $model) |
|
| 52 | - { |
|
| 53 | - $this->model = $model; |
|
| 54 | - } |
|
| 46 | + /** |
|
| 47 | + * DatetimeConnection constructor. |
|
| 48 | + * |
|
| 49 | + * @param EEM_Venue $model |
|
| 50 | + */ |
|
| 51 | + public function __construct(EEM_Venue $model) |
|
| 52 | + { |
|
| 53 | + $this->model = $model; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @return array |
|
| 59 | - * @since $VID:$ |
|
| 60 | - */ |
|
| 61 | - public function config() |
|
| 62 | - { |
|
| 63 | - return [ |
|
| 64 | - 'fromType' => 'Event', |
|
| 65 | - 'toType' => 'Venue', |
|
| 66 | - 'fromFieldName' => 'venues', |
|
| 67 | - 'connectionTypeName' => 'EventVenuesConnection', |
|
| 68 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | - 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | - ]; |
|
| 71 | - } |
|
| 57 | + /** |
|
| 58 | + * @return array |
|
| 59 | + * @since $VID:$ |
|
| 60 | + */ |
|
| 61 | + public function config() |
|
| 62 | + { |
|
| 63 | + return [ |
|
| 64 | + 'fromType' => 'Event', |
|
| 65 | + 'toType' => 'Venue', |
|
| 66 | + 'fromFieldName' => 'venues', |
|
| 67 | + 'connectionTypeName' => 'EventVenuesConnection', |
|
| 68 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | + 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | + ]; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * @param $entity |
|
| 76 | - * @param $args |
|
| 77 | - * @param $context |
|
| 78 | - * @param $info |
|
| 79 | - * @return array |
|
| 80 | - * @throws Exception |
|
| 81 | - * @since $VID:$ |
|
| 82 | - */ |
|
| 83 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | - { |
|
| 85 | - $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
| 86 | - return $resolver->get_connection(); |
|
| 87 | - } |
|
| 74 | + /** |
|
| 75 | + * @param $entity |
|
| 76 | + * @param $args |
|
| 77 | + * @param $context |
|
| 78 | + * @param $info |
|
| 79 | + * @return array |
|
| 80 | + * @throws Exception |
|
| 81 | + * @since $VID:$ |
|
| 82 | + */ |
|
| 83 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | + { |
|
| 85 | + $resolver = new VenueConnectionResolver($entity, $args, $context, $info); |
|
| 86 | + return $resolver->get_connection(); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @param $id |
|
| 92 | - * @param $args |
|
| 93 | - * @param $context |
|
| 94 | - * @param $info |
|
| 95 | - * @return EE_Base_Class |
|
| 96 | - * @since $VID:$ |
|
| 97 | - */ |
|
| 98 | - public function resolveNode($id, $args, $context, $info) |
|
| 99 | - { |
|
| 100 | - return $this->model->get_one_by_ID($id); |
|
| 101 | - } |
|
| 90 | + /** |
|
| 91 | + * @param $id |
|
| 92 | + * @param $args |
|
| 93 | + * @param $context |
|
| 94 | + * @param $info |
|
| 95 | + * @return EE_Base_Class |
|
| 96 | + * @since $VID:$ |
|
| 97 | + */ |
|
| 98 | + public function resolveNode($id, $args, $context, $info) |
|
| 99 | + { |
|
| 100 | + return $this->model->get_one_by_ID($id); |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | \ No newline at end of file |
@@ -37,66 +37,66 @@ |
||
| 37 | 37 | class TicketDatetimesConnection implements ConnectionInterface |
| 38 | 38 | { |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var EEM_Datetime $model |
|
| 42 | - */ |
|
| 43 | - protected $model; |
|
| 40 | + /** |
|
| 41 | + * @var EEM_Datetime $model |
|
| 42 | + */ |
|
| 43 | + protected $model; |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * DatetimeConnection constructor. |
|
| 48 | - * |
|
| 49 | - * @param EEM_Datetime $model |
|
| 50 | - */ |
|
| 51 | - public function __construct(EEM_Datetime $model) |
|
| 52 | - { |
|
| 53 | - $this->model = $model; |
|
| 54 | - } |
|
| 46 | + /** |
|
| 47 | + * DatetimeConnection constructor. |
|
| 48 | + * |
|
| 49 | + * @param EEM_Datetime $model |
|
| 50 | + */ |
|
| 51 | + public function __construct(EEM_Datetime $model) |
|
| 52 | + { |
|
| 53 | + $this->model = $model; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @return array |
|
| 59 | - * @since $VID:$ |
|
| 60 | - */ |
|
| 61 | - public function config() |
|
| 62 | - { |
|
| 63 | - return [ |
|
| 64 | - 'fromType' => 'Ticket', |
|
| 65 | - 'toType' => 'Datetime', |
|
| 66 | - 'fromFieldName' => 'datetimes', |
|
| 67 | - 'connectionTypeName' => 'TicketDatetimesConnection', |
|
| 68 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | - 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | - ]; |
|
| 71 | - } |
|
| 57 | + /** |
|
| 58 | + * @return array |
|
| 59 | + * @since $VID:$ |
|
| 60 | + */ |
|
| 61 | + public function config() |
|
| 62 | + { |
|
| 63 | + return [ |
|
| 64 | + 'fromType' => 'Ticket', |
|
| 65 | + 'toType' => 'Datetime', |
|
| 66 | + 'fromFieldName' => 'datetimes', |
|
| 67 | + 'connectionTypeName' => 'TicketDatetimesConnection', |
|
| 68 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | + 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | + ]; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * @param $entity |
|
| 76 | - * @param $args |
|
| 77 | - * @param $context |
|
| 78 | - * @param $info |
|
| 79 | - * @return array |
|
| 80 | - * @throws Exception |
|
| 81 | - * @since $VID:$ |
|
| 82 | - */ |
|
| 83 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | - { |
|
| 85 | - $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 86 | - return $resolver->get_connection(); |
|
| 87 | - } |
|
| 74 | + /** |
|
| 75 | + * @param $entity |
|
| 76 | + * @param $args |
|
| 77 | + * @param $context |
|
| 78 | + * @param $info |
|
| 79 | + * @return array |
|
| 80 | + * @throws Exception |
|
| 81 | + * @since $VID:$ |
|
| 82 | + */ |
|
| 83 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | + { |
|
| 85 | + $resolver = new DatetimeConnectionResolver($entity, $args, $context, $info); |
|
| 86 | + return $resolver->get_connection(); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @param $id |
|
| 92 | - * @param $args |
|
| 93 | - * @param $context |
|
| 94 | - * @param $info |
|
| 95 | - * @return EE_Base_Class |
|
| 96 | - * @since $VID:$ |
|
| 97 | - */ |
|
| 98 | - public function resolveNode($id, $args, $context, $info) |
|
| 99 | - { |
|
| 100 | - return $this->model->get_one_by_ID($id); |
|
| 101 | - } |
|
| 90 | + /** |
|
| 91 | + * @param $id |
|
| 92 | + * @param $args |
|
| 93 | + * @param $context |
|
| 94 | + * @param $info |
|
| 95 | + * @return EE_Base_Class |
|
| 96 | + * @since $VID:$ |
|
| 97 | + */ |
|
| 98 | + public function resolveNode($id, $args, $context, $info) |
|
| 99 | + { |
|
| 100 | + return $this->model->get_one_by_ID($id); |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | \ No newline at end of file |
@@ -37,66 +37,66 @@ |
||
| 37 | 37 | class DatetimeTicketsConnection implements ConnectionInterface |
| 38 | 38 | { |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var EEM_Ticket $model |
|
| 42 | - */ |
|
| 43 | - protected $model; |
|
| 40 | + /** |
|
| 41 | + * @var EEM_Ticket $model |
|
| 42 | + */ |
|
| 43 | + protected $model; |
|
| 44 | 44 | |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * DatetimeConnection constructor. |
|
| 48 | - * |
|
| 49 | - * @param EEM_Ticket $model |
|
| 50 | - */ |
|
| 51 | - public function __construct(EEM_Ticket $model) |
|
| 52 | - { |
|
| 53 | - $this->model = $model; |
|
| 54 | - } |
|
| 46 | + /** |
|
| 47 | + * DatetimeConnection constructor. |
|
| 48 | + * |
|
| 49 | + * @param EEM_Ticket $model |
|
| 50 | + */ |
|
| 51 | + public function __construct(EEM_Ticket $model) |
|
| 52 | + { |
|
| 53 | + $this->model = $model; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @return array |
|
| 59 | - * @since $VID:$ |
|
| 60 | - */ |
|
| 61 | - public function config() |
|
| 62 | - { |
|
| 63 | - return [ |
|
| 64 | - 'fromType' => 'Datetime', |
|
| 65 | - 'toType' => 'Ticket', |
|
| 66 | - 'fromFieldName' => 'tickets', |
|
| 67 | - 'connectionTypeName' => 'DatetimeTicketsConnection', |
|
| 68 | - 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | - 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | - ]; |
|
| 71 | - } |
|
| 57 | + /** |
|
| 58 | + * @return array |
|
| 59 | + * @since $VID:$ |
|
| 60 | + */ |
|
| 61 | + public function config() |
|
| 62 | + { |
|
| 63 | + return [ |
|
| 64 | + 'fromType' => 'Datetime', |
|
| 65 | + 'toType' => 'Ticket', |
|
| 66 | + 'fromFieldName' => 'tickets', |
|
| 67 | + 'connectionTypeName' => 'DatetimeTicketsConnection', |
|
| 68 | + 'resolve' => [$this, 'resolveConnection'], |
|
| 69 | + 'resolveNode' => [$this, 'resolveNode'] |
|
| 70 | + ]; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * @param $entity |
|
| 76 | - * @param $args |
|
| 77 | - * @param $context |
|
| 78 | - * @param $info |
|
| 79 | - * @return array |
|
| 80 | - * @throws Exception |
|
| 81 | - * @since $VID:$ |
|
| 82 | - */ |
|
| 83 | - public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | - { |
|
| 85 | - $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 86 | - return $resolver->get_connection(); |
|
| 87 | - } |
|
| 74 | + /** |
|
| 75 | + * @param $entity |
|
| 76 | + * @param $args |
|
| 77 | + * @param $context |
|
| 78 | + * @param $info |
|
| 79 | + * @return array |
|
| 80 | + * @throws Exception |
|
| 81 | + * @since $VID:$ |
|
| 82 | + */ |
|
| 83 | + public function resolveConnection($entity, $args, $context, $info) |
|
| 84 | + { |
|
| 85 | + $resolver = new TicketConnectionResolver($entity, $args, $context, $info); |
|
| 86 | + return $resolver->get_connection(); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | 89 | |
| 90 | - /** |
|
| 91 | - * @param $id |
|
| 92 | - * @param $args |
|
| 93 | - * @param $context |
|
| 94 | - * @param $info |
|
| 95 | - * @return EE_Base_Class |
|
| 96 | - * @since $VID:$ |
|
| 97 | - */ |
|
| 98 | - public function resolveNode($id, $args, $context, $info) |
|
| 99 | - { |
|
| 100 | - return $this->model->get_one_by_ID($id); |
|
| 101 | - } |
|
| 90 | + /** |
|
| 91 | + * @param $id |
|
| 92 | + * @param $args |
|
| 93 | + * @param $context |
|
| 94 | + * @param $info |
|
| 95 | + * @return EE_Base_Class |
|
| 96 | + * @since $VID:$ |
|
| 97 | + */ |
|
| 98 | + public function resolveNode($id, $args, $context, $info) |
|
| 99 | + { |
|
| 100 | + return $this->model->get_one_by_ID($id); |
|
| 101 | + } |
|
| 102 | 102 | } |
| 103 | 103 | \ No newline at end of file |
@@ -43,93 +43,93 @@ |
||
| 43 | 43 | class Country extends TypeBase |
| 44 | 44 | { |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Country constructor. |
|
| 48 | - * |
|
| 49 | - * @param EEM_Country $country_model |
|
| 50 | - */ |
|
| 51 | - public function __construct(EEM_Country $country_model) |
|
| 52 | - { |
|
| 53 | - $this->model = $country_model; |
|
| 54 | - $this->setName('Country'); |
|
| 55 | - $this->setDescription(__('A country', 'event_espresso')); |
|
| 56 | - $this->setIsCustomPostType(false); |
|
| 57 | - $this->setFields([ |
|
| 58 | - 'name' => [ |
|
| 59 | - 'type' => 'String', |
|
| 60 | - 'description' => __('Country Name', 'event_espresso'), |
|
| 61 | - 'resolve' => function (EE_Country $country) { |
|
| 62 | - return $this->resolveField($country, 'name'); |
|
| 63 | - }, |
|
| 64 | - ], |
|
| 65 | - 'currencyCode' => [ |
|
| 66 | - 'type' => 'String', |
|
| 67 | - 'description' => __('Country Currency Code', 'event_espresso'), |
|
| 68 | - 'resolve' => function (EE_Country $country) { |
|
| 69 | - return $this->resolveField($country, 'currency_code'); |
|
| 70 | - }, |
|
| 71 | - ], |
|
| 72 | - 'currencySingular' => [ |
|
| 73 | - 'type' => 'String', |
|
| 74 | - 'description' => __('Currency Name Singular', 'event_espresso'), |
|
| 75 | - 'resolve' => function (EE_Country $country) { |
|
| 76 | - return $this->resolveField($country, 'currency_name_single'); |
|
| 77 | - }, |
|
| 78 | - ], |
|
| 79 | - 'currencyPlural' => [ |
|
| 80 | - 'type' => 'String', |
|
| 81 | - 'description' => __('Currency Name Plural', 'event_espresso'), |
|
| 82 | - 'resolve' => function (EE_Country $country) { |
|
| 83 | - return $this->resolveField($country, 'currency_name_plural'); |
|
| 84 | - }, |
|
| 85 | - ], |
|
| 86 | - 'currencySign' => [ |
|
| 87 | - 'type' => 'String', |
|
| 88 | - 'description' => __('Currency Sign', 'event_espresso'), |
|
| 89 | - 'resolve' => function (EE_Country $country) { |
|
| 90 | - return $this->resolveField($country, 'currency_sign'); |
|
| 91 | - }, |
|
| 92 | - ], |
|
| 93 | - 'currencySignBeforeNumber' => [ |
|
| 94 | - 'type' => 'String', |
|
| 95 | - 'description' => __('Currency Sign Before Number', 'event_espresso'), |
|
| 96 | - 'resolve' => function (EE_Country $country) { |
|
| 97 | - return $this->resolveField($country, 'currency_sign_before'); |
|
| 98 | - }, |
|
| 99 | - ], |
|
| 100 | - 'currencyDecimalPlaces' => [ |
|
| 101 | - 'type' => 'String', |
|
| 102 | - 'description' => __('Currency Decimal Places', 'event_espresso'), |
|
| 103 | - 'resolve' => function (EE_Country $country) { |
|
| 104 | - return $this->resolveField($country, 'currency_decimal_places'); |
|
| 105 | - }, |
|
| 106 | - ], |
|
| 107 | - 'currencyDecimalMark' => [ |
|
| 108 | - 'type' => 'String', |
|
| 109 | - 'description' => __('Currency Decimal Mark', 'event_espresso'), |
|
| 110 | - 'resolve' => function (EE_Country $country) { |
|
| 111 | - return $this->resolveField($country, 'currency_decimal_mark'); |
|
| 112 | - }, |
|
| 113 | - ], |
|
| 114 | - 'currencyThousandsSeparator' => [ |
|
| 115 | - 'type' => 'String', |
|
| 116 | - 'description' => __('Currency Thousands Separator', 'event_espresso'), |
|
| 117 | - 'resolve' => function (EE_Country $country) { |
|
| 118 | - return $this->resolveField($country, 'currency_thousands_separator'); |
|
| 119 | - }, |
|
| 120 | - ], |
|
| 121 | - ] ); |
|
| 122 | - } |
|
| 46 | + /** |
|
| 47 | + * Country constructor. |
|
| 48 | + * |
|
| 49 | + * @param EEM_Country $country_model |
|
| 50 | + */ |
|
| 51 | + public function __construct(EEM_Country $country_model) |
|
| 52 | + { |
|
| 53 | + $this->model = $country_model; |
|
| 54 | + $this->setName('Country'); |
|
| 55 | + $this->setDescription(__('A country', 'event_espresso')); |
|
| 56 | + $this->setIsCustomPostType(false); |
|
| 57 | + $this->setFields([ |
|
| 58 | + 'name' => [ |
|
| 59 | + 'type' => 'String', |
|
| 60 | + 'description' => __('Country Name', 'event_espresso'), |
|
| 61 | + 'resolve' => function (EE_Country $country) { |
|
| 62 | + return $this->resolveField($country, 'name'); |
|
| 63 | + }, |
|
| 64 | + ], |
|
| 65 | + 'currencyCode' => [ |
|
| 66 | + 'type' => 'String', |
|
| 67 | + 'description' => __('Country Currency Code', 'event_espresso'), |
|
| 68 | + 'resolve' => function (EE_Country $country) { |
|
| 69 | + return $this->resolveField($country, 'currency_code'); |
|
| 70 | + }, |
|
| 71 | + ], |
|
| 72 | + 'currencySingular' => [ |
|
| 73 | + 'type' => 'String', |
|
| 74 | + 'description' => __('Currency Name Singular', 'event_espresso'), |
|
| 75 | + 'resolve' => function (EE_Country $country) { |
|
| 76 | + return $this->resolveField($country, 'currency_name_single'); |
|
| 77 | + }, |
|
| 78 | + ], |
|
| 79 | + 'currencyPlural' => [ |
|
| 80 | + 'type' => 'String', |
|
| 81 | + 'description' => __('Currency Name Plural', 'event_espresso'), |
|
| 82 | + 'resolve' => function (EE_Country $country) { |
|
| 83 | + return $this->resolveField($country, 'currency_name_plural'); |
|
| 84 | + }, |
|
| 85 | + ], |
|
| 86 | + 'currencySign' => [ |
|
| 87 | + 'type' => 'String', |
|
| 88 | + 'description' => __('Currency Sign', 'event_espresso'), |
|
| 89 | + 'resolve' => function (EE_Country $country) { |
|
| 90 | + return $this->resolveField($country, 'currency_sign'); |
|
| 91 | + }, |
|
| 92 | + ], |
|
| 93 | + 'currencySignBeforeNumber' => [ |
|
| 94 | + 'type' => 'String', |
|
| 95 | + 'description' => __('Currency Sign Before Number', 'event_espresso'), |
|
| 96 | + 'resolve' => function (EE_Country $country) { |
|
| 97 | + return $this->resolveField($country, 'currency_sign_before'); |
|
| 98 | + }, |
|
| 99 | + ], |
|
| 100 | + 'currencyDecimalPlaces' => [ |
|
| 101 | + 'type' => 'String', |
|
| 102 | + 'description' => __('Currency Decimal Places', 'event_espresso'), |
|
| 103 | + 'resolve' => function (EE_Country $country) { |
|
| 104 | + return $this->resolveField($country, 'currency_decimal_places'); |
|
| 105 | + }, |
|
| 106 | + ], |
|
| 107 | + 'currencyDecimalMark' => [ |
|
| 108 | + 'type' => 'String', |
|
| 109 | + 'description' => __('Currency Decimal Mark', 'event_espresso'), |
|
| 110 | + 'resolve' => function (EE_Country $country) { |
|
| 111 | + return $this->resolveField($country, 'currency_decimal_mark'); |
|
| 112 | + }, |
|
| 113 | + ], |
|
| 114 | + 'currencyThousandsSeparator' => [ |
|
| 115 | + 'type' => 'String', |
|
| 116 | + 'description' => __('Currency Thousands Separator', 'event_espresso'), |
|
| 117 | + 'resolve' => function (EE_Country $country) { |
|
| 118 | + return $this->resolveField($country, 'currency_thousands_separator'); |
|
| 119 | + }, |
|
| 120 | + ], |
|
| 121 | + ] ); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * @param EE_Country $country |
|
| 127 | - * @param mixed $field |
|
| 128 | - * @return string |
|
| 129 | - * @since $VID:$ |
|
| 130 | - */ |
|
| 131 | - public function resolveField(EE_Country $country, $field) |
|
| 132 | - { |
|
| 133 | - return $country instanceof EE_Country ? $country->{$field}() : null; |
|
| 134 | - } |
|
| 125 | + /** |
|
| 126 | + * @param EE_Country $country |
|
| 127 | + * @param mixed $field |
|
| 128 | + * @return string |
|
| 129 | + * @since $VID:$ |
|
| 130 | + */ |
|
| 131 | + public function resolveField(EE_Country $country, $field) |
|
| 132 | + { |
|
| 133 | + return $country instanceof EE_Country ? $country->{$field}() : null; |
|
| 134 | + } |
|
| 135 | 135 | } |
| 136 | 136 | \ No newline at end of file |
@@ -58,67 +58,67 @@ |
||
| 58 | 58 | 'name' => [ |
| 59 | 59 | 'type' => 'String', |
| 60 | 60 | 'description' => __('Country Name', 'event_espresso'), |
| 61 | - 'resolve' => function (EE_Country $country) { |
|
| 61 | + 'resolve' => function(EE_Country $country) { |
|
| 62 | 62 | return $this->resolveField($country, 'name'); |
| 63 | 63 | }, |
| 64 | 64 | ], |
| 65 | 65 | 'currencyCode' => [ |
| 66 | 66 | 'type' => 'String', |
| 67 | 67 | 'description' => __('Country Currency Code', 'event_espresso'), |
| 68 | - 'resolve' => function (EE_Country $country) { |
|
| 68 | + 'resolve' => function(EE_Country $country) { |
|
| 69 | 69 | return $this->resolveField($country, 'currency_code'); |
| 70 | 70 | }, |
| 71 | 71 | ], |
| 72 | 72 | 'currencySingular' => [ |
| 73 | 73 | 'type' => 'String', |
| 74 | 74 | 'description' => __('Currency Name Singular', 'event_espresso'), |
| 75 | - 'resolve' => function (EE_Country $country) { |
|
| 75 | + 'resolve' => function(EE_Country $country) { |
|
| 76 | 76 | return $this->resolveField($country, 'currency_name_single'); |
| 77 | 77 | }, |
| 78 | 78 | ], |
| 79 | 79 | 'currencyPlural' => [ |
| 80 | 80 | 'type' => 'String', |
| 81 | 81 | 'description' => __('Currency Name Plural', 'event_espresso'), |
| 82 | - 'resolve' => function (EE_Country $country) { |
|
| 82 | + 'resolve' => function(EE_Country $country) { |
|
| 83 | 83 | return $this->resolveField($country, 'currency_name_plural'); |
| 84 | 84 | }, |
| 85 | 85 | ], |
| 86 | 86 | 'currencySign' => [ |
| 87 | 87 | 'type' => 'String', |
| 88 | 88 | 'description' => __('Currency Sign', 'event_espresso'), |
| 89 | - 'resolve' => function (EE_Country $country) { |
|
| 89 | + 'resolve' => function(EE_Country $country) { |
|
| 90 | 90 | return $this->resolveField($country, 'currency_sign'); |
| 91 | 91 | }, |
| 92 | 92 | ], |
| 93 | 93 | 'currencySignBeforeNumber' => [ |
| 94 | 94 | 'type' => 'String', |
| 95 | 95 | 'description' => __('Currency Sign Before Number', 'event_espresso'), |
| 96 | - 'resolve' => function (EE_Country $country) { |
|
| 96 | + 'resolve' => function(EE_Country $country) { |
|
| 97 | 97 | return $this->resolveField($country, 'currency_sign_before'); |
| 98 | 98 | }, |
| 99 | 99 | ], |
| 100 | 100 | 'currencyDecimalPlaces' => [ |
| 101 | 101 | 'type' => 'String', |
| 102 | 102 | 'description' => __('Currency Decimal Places', 'event_espresso'), |
| 103 | - 'resolve' => function (EE_Country $country) { |
|
| 103 | + 'resolve' => function(EE_Country $country) { |
|
| 104 | 104 | return $this->resolveField($country, 'currency_decimal_places'); |
| 105 | 105 | }, |
| 106 | 106 | ], |
| 107 | 107 | 'currencyDecimalMark' => [ |
| 108 | 108 | 'type' => 'String', |
| 109 | 109 | 'description' => __('Currency Decimal Mark', 'event_espresso'), |
| 110 | - 'resolve' => function (EE_Country $country) { |
|
| 110 | + 'resolve' => function(EE_Country $country) { |
|
| 111 | 111 | return $this->resolveField($country, 'currency_decimal_mark'); |
| 112 | 112 | }, |
| 113 | 113 | ], |
| 114 | 114 | 'currencyThousandsSeparator' => [ |
| 115 | 115 | 'type' => 'String', |
| 116 | 116 | 'description' => __('Currency Thousands Separator', 'event_espresso'), |
| 117 | - 'resolve' => function (EE_Country $country) { |
|
| 117 | + 'resolve' => function(EE_Country $country) { |
|
| 118 | 118 | return $this->resolveField($country, 'currency_thousands_separator'); |
| 119 | 119 | }, |
| 120 | 120 | ], |
| 121 | - ] ); |
|
| 121 | + ]); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | |
@@ -44,82 +44,82 @@ |
||
| 44 | 44 | class State extends TypeBase |
| 45 | 45 | { |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * State constructor. |
|
| 49 | - * |
|
| 50 | - * @param EEM_State $state_model |
|
| 51 | - */ |
|
| 52 | - public function __construct(EEM_State $state_model) |
|
| 53 | - { |
|
| 54 | - $this->model = $state_model; |
|
| 55 | - $this->setName('State'); |
|
| 56 | - $this->setDescription(__('A state', 'event_espresso')); |
|
| 57 | - $this->setIsCustomPostType(false); |
|
| 58 | - $this->setFields([ |
|
| 59 | - 'id' => [ |
|
| 60 | - 'type' => [ |
|
| 61 | - 'non_null' => 'Int', |
|
| 62 | - ], |
|
| 63 | - 'description' => __( 'State ID', 'event_espresso' ), |
|
| 64 | - 'resolve' => function (EE_State $state) { |
|
| 65 | - return $this->resolveField($state, 'ID'); |
|
| 66 | - }, |
|
| 67 | - ], |
|
| 68 | - 'abbreviation' => [ |
|
| 69 | - 'type' => 'String', |
|
| 70 | - 'description' => __( 'State Abbreviation', 'event_espresso' ), |
|
| 71 | - 'resolve' => function (EE_State $state) { |
|
| 72 | - return $this->resolveField($state, 'abbrev' ); |
|
| 73 | - }, |
|
| 74 | - ], |
|
| 75 | - 'name' => [ |
|
| 76 | - 'type' => 'String', |
|
| 77 | - 'description' => __('State Name', 'event_espresso'), |
|
| 78 | - 'resolve' => function (EE_State $state) { |
|
| 79 | - return $this->resolveField($state, 'name' ); |
|
| 80 | - }, |
|
| 81 | - ], |
|
| 82 | - 'isActive' => [ |
|
| 83 | - 'type' => 'Boolean', |
|
| 84 | - 'description' => __('State Active Flag', 'event_espresso'), |
|
| 85 | - 'resolve' => function (EE_State $state) { |
|
| 86 | - return $this->resolveField($state, 'active' ); |
|
| 87 | - }, |
|
| 88 | - ], |
|
| 89 | - 'country' => [ |
|
| 90 | - 'type' => 'Country', |
|
| 91 | - 'description' => __('Country for the state', 'event_espresso'), |
|
| 92 | - 'resolve' => function (EE_State $state) { |
|
| 93 | - return $this->resolveCountry($state); |
|
| 94 | - }, |
|
| 95 | - ], |
|
| 96 | - ] ); |
|
| 97 | - } |
|
| 47 | + /** |
|
| 48 | + * State constructor. |
|
| 49 | + * |
|
| 50 | + * @param EEM_State $state_model |
|
| 51 | + */ |
|
| 52 | + public function __construct(EEM_State $state_model) |
|
| 53 | + { |
|
| 54 | + $this->model = $state_model; |
|
| 55 | + $this->setName('State'); |
|
| 56 | + $this->setDescription(__('A state', 'event_espresso')); |
|
| 57 | + $this->setIsCustomPostType(false); |
|
| 58 | + $this->setFields([ |
|
| 59 | + 'id' => [ |
|
| 60 | + 'type' => [ |
|
| 61 | + 'non_null' => 'Int', |
|
| 62 | + ], |
|
| 63 | + 'description' => __( 'State ID', 'event_espresso' ), |
|
| 64 | + 'resolve' => function (EE_State $state) { |
|
| 65 | + return $this->resolveField($state, 'ID'); |
|
| 66 | + }, |
|
| 67 | + ], |
|
| 68 | + 'abbreviation' => [ |
|
| 69 | + 'type' => 'String', |
|
| 70 | + 'description' => __( 'State Abbreviation', 'event_espresso' ), |
|
| 71 | + 'resolve' => function (EE_State $state) { |
|
| 72 | + return $this->resolveField($state, 'abbrev' ); |
|
| 73 | + }, |
|
| 74 | + ], |
|
| 75 | + 'name' => [ |
|
| 76 | + 'type' => 'String', |
|
| 77 | + 'description' => __('State Name', 'event_espresso'), |
|
| 78 | + 'resolve' => function (EE_State $state) { |
|
| 79 | + return $this->resolveField($state, 'name' ); |
|
| 80 | + }, |
|
| 81 | + ], |
|
| 82 | + 'isActive' => [ |
|
| 83 | + 'type' => 'Boolean', |
|
| 84 | + 'description' => __('State Active Flag', 'event_espresso'), |
|
| 85 | + 'resolve' => function (EE_State $state) { |
|
| 86 | + return $this->resolveField($state, 'active' ); |
|
| 87 | + }, |
|
| 88 | + ], |
|
| 89 | + 'country' => [ |
|
| 90 | + 'type' => 'Country', |
|
| 91 | + 'description' => __('Country for the state', 'event_espresso'), |
|
| 92 | + 'resolve' => function (EE_State $state) { |
|
| 93 | + return $this->resolveCountry($state); |
|
| 94 | + }, |
|
| 95 | + ], |
|
| 96 | + ] ); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | 99 | |
| 100 | - /** |
|
| 101 | - * @param EE_State $state |
|
| 102 | - * @param mixed $field |
|
| 103 | - * @return string |
|
| 104 | - * @since $VID:$ |
|
| 105 | - */ |
|
| 106 | - public function resolveField(EE_State $state, $field) |
|
| 107 | - { |
|
| 108 | - return $state instanceof EE_State ? $state->{$field}() : null; |
|
| 109 | - } |
|
| 100 | + /** |
|
| 101 | + * @param EE_State $state |
|
| 102 | + * @param mixed $field |
|
| 103 | + * @return string |
|
| 104 | + * @since $VID:$ |
|
| 105 | + */ |
|
| 106 | + public function resolveField(EE_State $state, $field) |
|
| 107 | + { |
|
| 108 | + return $state instanceof EE_State ? $state->{$field}() : null; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * @param EE_State $source The source instance. |
|
| 114 | - * @return int |
|
| 115 | - * @since $VID:$ |
|
| 116 | - */ |
|
| 117 | - public function resolveCountry(EE_State $source) |
|
| 118 | - { |
|
| 119 | - $country_iso = $source->country_iso(); |
|
| 120 | - if ($country_iso) { |
|
| 121 | - return EEM_Country::instance()->get_one_by_ID($country_iso); |
|
| 122 | - } |
|
| 123 | - return null; |
|
| 124 | - } |
|
| 112 | + /** |
|
| 113 | + * @param EE_State $source The source instance. |
|
| 114 | + * @return int |
|
| 115 | + * @since $VID:$ |
|
| 116 | + */ |
|
| 117 | + public function resolveCountry(EE_State $source) |
|
| 118 | + { |
|
| 119 | + $country_iso = $source->country_iso(); |
|
| 120 | + if ($country_iso) { |
|
| 121 | + return EEM_Country::instance()->get_one_by_ID($country_iso); |
|
| 122 | + } |
|
| 123 | + return null; |
|
| 124 | + } |
|
| 125 | 125 | } |
| 126 | 126 | \ No newline at end of file |
@@ -60,40 +60,40 @@ |
||
| 60 | 60 | 'type' => [ |
| 61 | 61 | 'non_null' => 'Int', |
| 62 | 62 | ], |
| 63 | - 'description' => __( 'State ID', 'event_espresso' ), |
|
| 64 | - 'resolve' => function (EE_State $state) { |
|
| 63 | + 'description' => __('State ID', 'event_espresso'), |
|
| 64 | + 'resolve' => function(EE_State $state) { |
|
| 65 | 65 | return $this->resolveField($state, 'ID'); |
| 66 | 66 | }, |
| 67 | 67 | ], |
| 68 | 68 | 'abbreviation' => [ |
| 69 | 69 | 'type' => 'String', |
| 70 | - 'description' => __( 'State Abbreviation', 'event_espresso' ), |
|
| 71 | - 'resolve' => function (EE_State $state) { |
|
| 72 | - return $this->resolveField($state, 'abbrev' ); |
|
| 70 | + 'description' => __('State Abbreviation', 'event_espresso'), |
|
| 71 | + 'resolve' => function(EE_State $state) { |
|
| 72 | + return $this->resolveField($state, 'abbrev'); |
|
| 73 | 73 | }, |
| 74 | 74 | ], |
| 75 | 75 | 'name' => [ |
| 76 | 76 | 'type' => 'String', |
| 77 | 77 | 'description' => __('State Name', 'event_espresso'), |
| 78 | - 'resolve' => function (EE_State $state) { |
|
| 79 | - return $this->resolveField($state, 'name' ); |
|
| 78 | + 'resolve' => function(EE_State $state) { |
|
| 79 | + return $this->resolveField($state, 'name'); |
|
| 80 | 80 | }, |
| 81 | 81 | ], |
| 82 | 82 | 'isActive' => [ |
| 83 | 83 | 'type' => 'Boolean', |
| 84 | 84 | 'description' => __('State Active Flag', 'event_espresso'), |
| 85 | - 'resolve' => function (EE_State $state) { |
|
| 86 | - return $this->resolveField($state, 'active' ); |
|
| 85 | + 'resolve' => function(EE_State $state) { |
|
| 86 | + return $this->resolveField($state, 'active'); |
|
| 87 | 87 | }, |
| 88 | 88 | ], |
| 89 | 89 | 'country' => [ |
| 90 | 90 | 'type' => 'Country', |
| 91 | 91 | 'description' => __('Country for the state', 'event_espresso'), |
| 92 | - 'resolve' => function (EE_State $state) { |
|
| 92 | + 'resolve' => function(EE_State $state) { |
|
| 93 | 93 | return $this->resolveCountry($state); |
| 94 | 94 | }, |
| 95 | 95 | ], |
| 96 | - ] ); |
|
| 96 | + ]); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |