@@ -28,58 +28,58 @@ |
||
28 | 28 | class RestApiSpoofer |
29 | 29 | { |
30 | 30 | |
31 | - /** |
|
32 | - * @var Read |
|
33 | - */ |
|
34 | - protected $rest_api; |
|
31 | + /** |
|
32 | + * @var Read |
|
33 | + */ |
|
34 | + protected $rest_api; |
|
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * RestApiSpoofer constructor. |
|
39 | - * |
|
40 | - * @param Read $rest_api |
|
41 | - * @param string $api_version |
|
42 | - */ |
|
43 | - public function __construct(Read $rest_api, $api_version = '4.8.36') |
|
44 | - { |
|
45 | - $this->rest_api = $rest_api; |
|
46 | - $this->rest_api->setRequestedVersion($api_version); |
|
47 | - } |
|
37 | + /** |
|
38 | + * RestApiSpoofer constructor. |
|
39 | + * |
|
40 | + * @param Read $rest_api |
|
41 | + * @param string $api_version |
|
42 | + */ |
|
43 | + public function __construct(Read $rest_api, $api_version = '4.8.36') |
|
44 | + { |
|
45 | + $this->rest_api = $rest_api; |
|
46 | + $this->rest_api->setRequestedVersion($api_version); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @param EEM_Base $model |
|
52 | - * @param array $query_params |
|
53 | - * @param string $include |
|
54 | - * @return array |
|
55 | - * @throws EE_Error |
|
56 | - * @throws InvalidArgumentException |
|
57 | - * @throws InvalidDataTypeException |
|
58 | - * @throws InvalidInterfaceException |
|
59 | - * @throws ModelConfigurationException |
|
60 | - * @throws ReflectionException |
|
61 | - * @throws RestException |
|
62 | - * @throws RestPasswordIncorrectException |
|
63 | - * @throws RestPasswordRequiredException |
|
64 | - * @throws UnexpectedEntityException |
|
65 | - * @throws DomainException |
|
66 | - * @since $VID:$ |
|
67 | - */ |
|
68 | - public function getApiResults(EEM_Base $model, array $query_params, $include = '') |
|
69 | - { |
|
70 | - /** @type array $results */ |
|
71 | - $results = $model->get_all_wpdb_results($query_params); |
|
72 | - $rest_request = new WP_REST_Request(); |
|
73 | - $rest_request->set_param('include', $include); |
|
74 | - $rest_request->set_param('caps', 'edit'); |
|
75 | - $nice_results = array(); |
|
76 | - foreach ($results as $result) { |
|
77 | - $nice_results[] = $this->rest_api->createEntityFromWpdbResult( |
|
78 | - $model, |
|
79 | - $result, |
|
80 | - $rest_request |
|
81 | - ); |
|
82 | - } |
|
83 | - return $nice_results; |
|
84 | - } |
|
50 | + /** |
|
51 | + * @param EEM_Base $model |
|
52 | + * @param array $query_params |
|
53 | + * @param string $include |
|
54 | + * @return array |
|
55 | + * @throws EE_Error |
|
56 | + * @throws InvalidArgumentException |
|
57 | + * @throws InvalidDataTypeException |
|
58 | + * @throws InvalidInterfaceException |
|
59 | + * @throws ModelConfigurationException |
|
60 | + * @throws ReflectionException |
|
61 | + * @throws RestException |
|
62 | + * @throws RestPasswordIncorrectException |
|
63 | + * @throws RestPasswordRequiredException |
|
64 | + * @throws UnexpectedEntityException |
|
65 | + * @throws DomainException |
|
66 | + * @since $VID:$ |
|
67 | + */ |
|
68 | + public function getApiResults(EEM_Base $model, array $query_params, $include = '') |
|
69 | + { |
|
70 | + /** @type array $results */ |
|
71 | + $results = $model->get_all_wpdb_results($query_params); |
|
72 | + $rest_request = new WP_REST_Request(); |
|
73 | + $rest_request->set_param('include', $include); |
|
74 | + $rest_request->set_param('caps', 'edit'); |
|
75 | + $nice_results = array(); |
|
76 | + foreach ($results as $result) { |
|
77 | + $nice_results[] = $this->rest_api->createEntityFromWpdbResult( |
|
78 | + $model, |
|
79 | + $result, |
|
80 | + $rest_request |
|
81 | + ); |
|
82 | + } |
|
83 | + return $nice_results; |
|
84 | + } |
|
85 | 85 | } |
@@ -21,86 +21,86 @@ |
||
21 | 21 | class ResolverCollection extends Collection |
22 | 22 | { |
23 | 23 | |
24 | - const COLLECTION_NAME = 'espresso_graphql_resolvers'; |
|
24 | + const COLLECTION_NAME = 'espresso_graphql_resolvers'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var CollectionLoader $loader |
|
28 | - */ |
|
29 | - protected $loader; |
|
26 | + /** |
|
27 | + * @var CollectionLoader $loader |
|
28 | + */ |
|
29 | + protected $loader; |
|
30 | 30 | |
31 | - /** |
|
32 | - * ResolverCollection constructor |
|
33 | - * |
|
34 | - * @throws InvalidInterfaceException |
|
35 | - */ |
|
36 | - public function __construct() |
|
37 | - { |
|
38 | - parent::__construct( |
|
39 | - 'EventEspresso\core\services\graphql\ResolverInterface', |
|
40 | - ResolverCollection::COLLECTION_NAME |
|
41 | - ); |
|
42 | - } |
|
31 | + /** |
|
32 | + * ResolverCollection constructor |
|
33 | + * |
|
34 | + * @throws InvalidInterfaceException |
|
35 | + */ |
|
36 | + public function __construct() |
|
37 | + { |
|
38 | + parent::__construct( |
|
39 | + 'EventEspresso\core\services\graphql\ResolverInterface', |
|
40 | + ResolverCollection::COLLECTION_NAME |
|
41 | + ); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @throws CollectionDetailsException |
|
47 | - * @throws CollectionLoaderException |
|
48 | - * @since $VID:$ |
|
49 | - */ |
|
50 | - private function loadCollection() |
|
51 | - { |
|
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
53 | - $this->loader = new CollectionLoader( |
|
54 | - new CollectionDetails( |
|
55 | - // collection name |
|
56 | - ResolverCollection::COLLECTION_NAME, |
|
57 | - // collection interface |
|
58 | - 'EventEspresso\core\services\graphql\ResolverInterface', |
|
59 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
60 | - apply_filters( |
|
61 | - 'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs', |
|
62 | - ['EventEspresso\core\domain\services\graphql\resolvers'] |
|
63 | - ), |
|
64 | - // filepaths to classes to add |
|
65 | - array(), |
|
66 | - // file mask to use if parsing folder for files to add |
|
67 | - '', |
|
68 | - // what to use as identifier for collection entities |
|
69 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
70 | - CollectionDetails::ID_CLASS_NAME |
|
71 | - ), |
|
72 | - $this |
|
73 | - ); |
|
74 | - } |
|
75 | - } |
|
45 | + /** |
|
46 | + * @throws CollectionDetailsException |
|
47 | + * @throws CollectionLoaderException |
|
48 | + * @since $VID:$ |
|
49 | + */ |
|
50 | + private function loadCollection() |
|
51 | + { |
|
52 | + if (! $this->loader instanceof CollectionLoader) { |
|
53 | + $this->loader = new CollectionLoader( |
|
54 | + new CollectionDetails( |
|
55 | + // collection name |
|
56 | + ResolverCollection::COLLECTION_NAME, |
|
57 | + // collection interface |
|
58 | + 'EventEspresso\core\services\graphql\ResolverInterface', |
|
59 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
60 | + apply_filters( |
|
61 | + 'FHEE__EventEspresso_core_services_graphql_ResolverCollection__loadCollection__collection_FQCNs', |
|
62 | + ['EventEspresso\core\domain\services\graphql\resolvers'] |
|
63 | + ), |
|
64 | + // filepaths to classes to add |
|
65 | + array(), |
|
66 | + // file mask to use if parsing folder for files to add |
|
67 | + '', |
|
68 | + // what to use as identifier for collection entities |
|
69 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
70 | + CollectionDetails::ID_CLASS_NAME |
|
71 | + ), |
|
72 | + $this |
|
73 | + ); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @return CollectionInterface |
|
80 | - * @throws CollectionDetailsException |
|
81 | - * @throws CollectionLoaderException |
|
82 | - * @since $VID:$ |
|
83 | - */ |
|
84 | - public function loadResolvers() |
|
85 | - { |
|
86 | - $this->loadCollection(); |
|
87 | - return $this->loader->getCollection(); |
|
88 | - } |
|
78 | + /** |
|
79 | + * @return CollectionInterface |
|
80 | + * @throws CollectionDetailsException |
|
81 | + * @throws CollectionLoaderException |
|
82 | + * @since $VID:$ |
|
83 | + */ |
|
84 | + public function loadResolvers() |
|
85 | + { |
|
86 | + $this->loadCollection(); |
|
87 | + return $this->loader->getCollection(); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * getIdentifier |
|
93 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
94 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
95 | - * |
|
96 | - * @param $object |
|
97 | - * @param mixed $identifier |
|
98 | - * @return bool |
|
99 | - */ |
|
100 | - public function getIdentifier($object, $identifier = null) |
|
101 | - { |
|
102 | - return ! empty($identifier) |
|
103 | - ? $identifier |
|
104 | - : get_class($object); |
|
105 | - } |
|
91 | + /** |
|
92 | + * getIdentifier |
|
93 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
94 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
95 | + * |
|
96 | + * @param $object |
|
97 | + * @param mixed $identifier |
|
98 | + * @return bool |
|
99 | + */ |
|
100 | + public function getIdentifier($object, $identifier = null) |
|
101 | + { |
|
102 | + return ! empty($identifier) |
|
103 | + ? $identifier |
|
104 | + : get_class($object); |
|
105 | + } |
|
106 | 106 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | private function loadCollection() |
51 | 51 | { |
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
53 | 53 | $this->loader = new CollectionLoader( |
54 | 54 | new CollectionDetails( |
55 | 55 | // collection name |
@@ -21,86 +21,86 @@ |
||
21 | 21 | class ConnectionCollection extends Collection |
22 | 22 | { |
23 | 23 | |
24 | - const COLLECTION_NAME = 'espresso_graphql_connections'; |
|
24 | + const COLLECTION_NAME = 'espresso_graphql_connections'; |
|
25 | 25 | |
26 | - /** |
|
27 | - * @var CollectionLoader $loader |
|
28 | - */ |
|
29 | - protected $loader; |
|
26 | + /** |
|
27 | + * @var CollectionLoader $loader |
|
28 | + */ |
|
29 | + protected $loader; |
|
30 | 30 | |
31 | - /** |
|
32 | - * ConnectionCollection constructor |
|
33 | - * |
|
34 | - * @throws InvalidInterfaceException |
|
35 | - */ |
|
36 | - public function __construct() |
|
37 | - { |
|
38 | - parent::__construct( |
|
39 | - 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
40 | - ConnectionCollection::COLLECTION_NAME |
|
41 | - ); |
|
42 | - } |
|
31 | + /** |
|
32 | + * ConnectionCollection constructor |
|
33 | + * |
|
34 | + * @throws InvalidInterfaceException |
|
35 | + */ |
|
36 | + public function __construct() |
|
37 | + { |
|
38 | + parent::__construct( |
|
39 | + 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
40 | + ConnectionCollection::COLLECTION_NAME |
|
41 | + ); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - /** |
|
46 | - * @throws CollectionDetailsException |
|
47 | - * @throws CollectionLoaderException |
|
48 | - * @since $VID:$ |
|
49 | - */ |
|
50 | - private function loadCollection() |
|
51 | - { |
|
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
53 | - $this->loader = new CollectionLoader( |
|
54 | - new CollectionDetails( |
|
55 | - // collection name |
|
56 | - ConnectionCollection::COLLECTION_NAME, |
|
57 | - // collection interface |
|
58 | - 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
59 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
60 | - apply_filters( |
|
61 | - 'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs', |
|
62 | - ['EventEspresso\core\domain\services\graphql\connections'] |
|
63 | - ), |
|
64 | - // filepaths to classes to add |
|
65 | - array(), |
|
66 | - // file mask to use if parsing folder for files to add |
|
67 | - '', |
|
68 | - // what to use as identifier for collection entities |
|
69 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
70 | - CollectionDetails::ID_CLASS_NAME |
|
71 | - ), |
|
72 | - $this |
|
73 | - ); |
|
74 | - } |
|
75 | - } |
|
45 | + /** |
|
46 | + * @throws CollectionDetailsException |
|
47 | + * @throws CollectionLoaderException |
|
48 | + * @since $VID:$ |
|
49 | + */ |
|
50 | + private function loadCollection() |
|
51 | + { |
|
52 | + if (! $this->loader instanceof CollectionLoader) { |
|
53 | + $this->loader = new CollectionLoader( |
|
54 | + new CollectionDetails( |
|
55 | + // collection name |
|
56 | + ConnectionCollection::COLLECTION_NAME, |
|
57 | + // collection interface |
|
58 | + 'EventEspresso\core\services\graphql\connections\ConnectionInterface', |
|
59 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
60 | + apply_filters( |
|
61 | + 'FHEE__EventEspresso_core_services_graphql_ConnectionCollection__loadCollection__collection_FQCNs', |
|
62 | + ['EventEspresso\core\domain\services\graphql\connections'] |
|
63 | + ), |
|
64 | + // filepaths to classes to add |
|
65 | + array(), |
|
66 | + // file mask to use if parsing folder for files to add |
|
67 | + '', |
|
68 | + // what to use as identifier for collection entities |
|
69 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
70 | + CollectionDetails::ID_CLASS_NAME |
|
71 | + ), |
|
72 | + $this |
|
73 | + ); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * @return CollectionInterface |
|
80 | - * @throws CollectionDetailsException |
|
81 | - * @throws CollectionLoaderException |
|
82 | - * @since $VID:$ |
|
83 | - */ |
|
84 | - public function loadConnections() |
|
85 | - { |
|
86 | - $this->loadCollection(); |
|
87 | - return $this->loader->getCollection(); |
|
88 | - } |
|
78 | + /** |
|
79 | + * @return CollectionInterface |
|
80 | + * @throws CollectionDetailsException |
|
81 | + * @throws CollectionLoaderException |
|
82 | + * @since $VID:$ |
|
83 | + */ |
|
84 | + public function loadConnections() |
|
85 | + { |
|
86 | + $this->loadCollection(); |
|
87 | + return $this->loader->getCollection(); |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * getIdentifier |
|
93 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
94 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
95 | - * |
|
96 | - * @param $object |
|
97 | - * @param mixed $identifier |
|
98 | - * @return bool |
|
99 | - */ |
|
100 | - public function getIdentifier($object, $identifier = null) |
|
101 | - { |
|
102 | - return ! empty($identifier) |
|
103 | - ? $identifier |
|
104 | - : get_class($object); |
|
105 | - } |
|
91 | + /** |
|
92 | + * getIdentifier |
|
93 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
94 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
95 | + * |
|
96 | + * @param $object |
|
97 | + * @param mixed $identifier |
|
98 | + * @return bool |
|
99 | + */ |
|
100 | + public function getIdentifier($object, $identifier = null) |
|
101 | + { |
|
102 | + return ! empty($identifier) |
|
103 | + ? $identifier |
|
104 | + : get_class($object); |
|
105 | + } |
|
106 | 106 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | private function loadCollection() |
51 | 51 | { |
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
53 | 53 | $this->loader = new CollectionLoader( |
54 | 54 | new CollectionDetails( |
55 | 55 | // collection name |
@@ -13,21 +13,21 @@ |
||
13 | 13 | interface EnumInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @return string |
|
18 | - */ |
|
19 | - public function name(); |
|
16 | + /** |
|
17 | + * @return string |
|
18 | + */ |
|
19 | + public function name(); |
|
20 | 20 | |
21 | 21 | |
22 | - /** |
|
23 | - * @return string |
|
24 | - */ |
|
25 | - public function description(); |
|
22 | + /** |
|
23 | + * @return string |
|
24 | + */ |
|
25 | + public function description(); |
|
26 | 26 | |
27 | 27 | |
28 | - /** |
|
29 | - * @return array |
|
30 | - * @since $VID:$ |
|
31 | - */ |
|
32 | - public function values(); |
|
28 | + /** |
|
29 | + * @return array |
|
30 | + * @since $VID:$ |
|
31 | + */ |
|
32 | + public function values(); |
|
33 | 33 | } |
@@ -20,86 +20,86 @@ |
||
20 | 20 | */ |
21 | 21 | class EnumCollection extends Collection |
22 | 22 | { |
23 | - const COLLECTION_NAME = 'espresso_graphql_enums'; |
|
23 | + const COLLECTION_NAME = 'espresso_graphql_enums'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * @var CollectionLoader $loader |
|
27 | - */ |
|
28 | - protected $loader; |
|
25 | + /** |
|
26 | + * @var CollectionLoader $loader |
|
27 | + */ |
|
28 | + protected $loader; |
|
29 | 29 | |
30 | - /** |
|
31 | - * EnumCollection constructor |
|
32 | - * |
|
33 | - * @throws InvalidInterfaceException |
|
34 | - */ |
|
35 | - public function __construct() |
|
36 | - { |
|
37 | - parent::__construct( |
|
38 | - 'EventEspresso\core\services\graphql\enums\EnumInterface', |
|
39 | - EnumCollection::COLLECTION_NAME |
|
40 | - ); |
|
41 | - } |
|
30 | + /** |
|
31 | + * EnumCollection constructor |
|
32 | + * |
|
33 | + * @throws InvalidInterfaceException |
|
34 | + */ |
|
35 | + public function __construct() |
|
36 | + { |
|
37 | + parent::__construct( |
|
38 | + 'EventEspresso\core\services\graphql\enums\EnumInterface', |
|
39 | + EnumCollection::COLLECTION_NAME |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * @throws CollectionDetailsException |
|
46 | - * @throws CollectionLoaderException |
|
47 | - * @since $VID:$ |
|
48 | - */ |
|
49 | - private function loadCollection() |
|
50 | - { |
|
51 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | - $this->loader = new CollectionLoader( |
|
53 | - new CollectionDetails( |
|
54 | - // collection name |
|
55 | - EnumCollection::COLLECTION_NAME, |
|
56 | - // collection interface |
|
57 | - 'EventEspresso\core\services\graphql\enums\EnumInterface', |
|
58 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
59 | - apply_filters( |
|
60 | - 'FHEE__EventEspresso_core_services_graphql_EnumCollection__loadCollection__collection_FQCNs', |
|
61 | - ['EventEspresso\core\domain\services\graphql\enums'] |
|
62 | - ), |
|
63 | - // filepaths to classes to add |
|
64 | - array(), |
|
65 | - // file mask to use if parsing folder for files to add |
|
66 | - '', |
|
67 | - // what to use as identifier for collection entities |
|
68 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
69 | - CollectionDetails::ID_CLASS_NAME |
|
70 | - ), |
|
71 | - $this |
|
72 | - ); |
|
73 | - } |
|
74 | - } |
|
44 | + /** |
|
45 | + * @throws CollectionDetailsException |
|
46 | + * @throws CollectionLoaderException |
|
47 | + * @since $VID:$ |
|
48 | + */ |
|
49 | + private function loadCollection() |
|
50 | + { |
|
51 | + if (! $this->loader instanceof CollectionLoader) { |
|
52 | + $this->loader = new CollectionLoader( |
|
53 | + new CollectionDetails( |
|
54 | + // collection name |
|
55 | + EnumCollection::COLLECTION_NAME, |
|
56 | + // collection interface |
|
57 | + 'EventEspresso\core\services\graphql\enums\EnumInterface', |
|
58 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
59 | + apply_filters( |
|
60 | + 'FHEE__EventEspresso_core_services_graphql_EnumCollection__loadCollection__collection_FQCNs', |
|
61 | + ['EventEspresso\core\domain\services\graphql\enums'] |
|
62 | + ), |
|
63 | + // filepaths to classes to add |
|
64 | + array(), |
|
65 | + // file mask to use if parsing folder for files to add |
|
66 | + '', |
|
67 | + // what to use as identifier for collection entities |
|
68 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
69 | + CollectionDetails::ID_CLASS_NAME |
|
70 | + ), |
|
71 | + $this |
|
72 | + ); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | - /** |
|
78 | - * @return CollectionInterface |
|
79 | - * @throws CollectionDetailsException |
|
80 | - * @throws CollectionLoaderException |
|
81 | - * @since $VID:$ |
|
82 | - */ |
|
83 | - public function loadEnums() |
|
84 | - { |
|
85 | - $this->loadCollection(); |
|
86 | - return $this->loader->getCollection(); |
|
87 | - } |
|
77 | + /** |
|
78 | + * @return CollectionInterface |
|
79 | + * @throws CollectionDetailsException |
|
80 | + * @throws CollectionLoaderException |
|
81 | + * @since $VID:$ |
|
82 | + */ |
|
83 | + public function loadEnums() |
|
84 | + { |
|
85 | + $this->loadCollection(); |
|
86 | + return $this->loader->getCollection(); |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | - /** |
|
91 | - * getIdentifier |
|
92 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
93 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
94 | - * |
|
95 | - * @param $object |
|
96 | - * @param mixed $identifier |
|
97 | - * @return bool |
|
98 | - */ |
|
99 | - public function getIdentifier($object, $identifier = null) |
|
100 | - { |
|
101 | - return ! empty($identifier) |
|
102 | - ? $identifier |
|
103 | - : get_class($object); |
|
104 | - } |
|
90 | + /** |
|
91 | + * getIdentifier |
|
92 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
93 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
94 | + * |
|
95 | + * @param $object |
|
96 | + * @param mixed $identifier |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | + public function getIdentifier($object, $identifier = null) |
|
100 | + { |
|
101 | + return ! empty($identifier) |
|
102 | + ? $identifier |
|
103 | + : get_class($object); |
|
104 | + } |
|
105 | 105 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | private function loadCollection() |
51 | 51 | { |
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
53 | 53 | $this->loader = new CollectionLoader( |
54 | 54 | new CollectionDetails( |
55 | 55 | // collection name |
@@ -15,21 +15,21 @@ |
||
15 | 15 | interface InputInterface |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @return string |
|
20 | - */ |
|
21 | - public function name(); |
|
18 | + /** |
|
19 | + * @return string |
|
20 | + */ |
|
21 | + public function name(); |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * @return string |
|
26 | - */ |
|
27 | - public function description(); |
|
24 | + /** |
|
25 | + * @return string |
|
26 | + */ |
|
27 | + public function description(); |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[] |
|
32 | - * @since $VID:$ |
|
33 | - */ |
|
34 | - public function fields(); |
|
30 | + /** |
|
31 | + * @return \EventEspresso\core\services\graphql\fields\GraphQLFieldInterface[] |
|
32 | + * @since $VID:$ |
|
33 | + */ |
|
34 | + public function fields(); |
|
35 | 35 | } |
@@ -20,86 +20,86 @@ |
||
20 | 20 | */ |
21 | 21 | class InputCollection extends Collection |
22 | 22 | { |
23 | - const COLLECTION_NAME = 'espresso_graphql_inputs'; |
|
23 | + const COLLECTION_NAME = 'espresso_graphql_inputs'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * @var CollectionLoader $loader |
|
27 | - */ |
|
28 | - protected $loader; |
|
25 | + /** |
|
26 | + * @var CollectionLoader $loader |
|
27 | + */ |
|
28 | + protected $loader; |
|
29 | 29 | |
30 | - /** |
|
31 | - * InputCollection constructor |
|
32 | - * |
|
33 | - * @throws InvalidInterfaceException |
|
34 | - */ |
|
35 | - public function __construct() |
|
36 | - { |
|
37 | - parent::__construct( |
|
38 | - 'EventEspresso\core\services\graphql\inputs\InputInterface', |
|
39 | - InputCollection::COLLECTION_NAME |
|
40 | - ); |
|
41 | - } |
|
30 | + /** |
|
31 | + * InputCollection constructor |
|
32 | + * |
|
33 | + * @throws InvalidInterfaceException |
|
34 | + */ |
|
35 | + public function __construct() |
|
36 | + { |
|
37 | + parent::__construct( |
|
38 | + 'EventEspresso\core\services\graphql\inputs\InputInterface', |
|
39 | + InputCollection::COLLECTION_NAME |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | |
44 | - /** |
|
45 | - * @throws CollectionDetailsException |
|
46 | - * @throws CollectionLoaderException |
|
47 | - * @since $VID:$ |
|
48 | - */ |
|
49 | - private function loadCollection() |
|
50 | - { |
|
51 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | - $this->loader = new CollectionLoader( |
|
53 | - new CollectionDetails( |
|
54 | - // collection name |
|
55 | - InputCollection::COLLECTION_NAME, |
|
56 | - // collection interface |
|
57 | - 'EventEspresso\core\services\graphql\inputs\InputInterface', |
|
58 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
59 | - apply_filters( |
|
60 | - 'FHEE__EventEspresso_core_services_graphql_InputCollection__loadCollection__collection_FQCNs', |
|
61 | - ['EventEspresso\core\domain\services\graphql\inputs'] |
|
62 | - ), |
|
63 | - // filepaths to classes to add |
|
64 | - array(), |
|
65 | - // file mask to use if parsing folder for files to add |
|
66 | - '', |
|
67 | - // what to use as identifier for collection entities |
|
68 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
69 | - CollectionDetails::ID_CLASS_NAME |
|
70 | - ), |
|
71 | - $this |
|
72 | - ); |
|
73 | - } |
|
74 | - } |
|
44 | + /** |
|
45 | + * @throws CollectionDetailsException |
|
46 | + * @throws CollectionLoaderException |
|
47 | + * @since $VID:$ |
|
48 | + */ |
|
49 | + private function loadCollection() |
|
50 | + { |
|
51 | + if (! $this->loader instanceof CollectionLoader) { |
|
52 | + $this->loader = new CollectionLoader( |
|
53 | + new CollectionDetails( |
|
54 | + // collection name |
|
55 | + InputCollection::COLLECTION_NAME, |
|
56 | + // collection interface |
|
57 | + 'EventEspresso\core\services\graphql\inputs\InputInterface', |
|
58 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
59 | + apply_filters( |
|
60 | + 'FHEE__EventEspresso_core_services_graphql_InputCollection__loadCollection__collection_FQCNs', |
|
61 | + ['EventEspresso\core\domain\services\graphql\inputs'] |
|
62 | + ), |
|
63 | + // filepaths to classes to add |
|
64 | + array(), |
|
65 | + // file mask to use if parsing folder for files to add |
|
66 | + '', |
|
67 | + // what to use as identifier for collection entities |
|
68 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
69 | + CollectionDetails::ID_CLASS_NAME |
|
70 | + ), |
|
71 | + $this |
|
72 | + ); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | 76 | |
77 | - /** |
|
78 | - * @return CollectionInterface |
|
79 | - * @throws CollectionDetailsException |
|
80 | - * @throws CollectionLoaderException |
|
81 | - * @since $VID:$ |
|
82 | - */ |
|
83 | - public function loadInputs() |
|
84 | - { |
|
85 | - $this->loadCollection(); |
|
86 | - return $this->loader->getCollection(); |
|
87 | - } |
|
77 | + /** |
|
78 | + * @return CollectionInterface |
|
79 | + * @throws CollectionDetailsException |
|
80 | + * @throws CollectionLoaderException |
|
81 | + * @since $VID:$ |
|
82 | + */ |
|
83 | + public function loadInputs() |
|
84 | + { |
|
85 | + $this->loadCollection(); |
|
86 | + return $this->loader->getCollection(); |
|
87 | + } |
|
88 | 88 | |
89 | 89 | |
90 | - /** |
|
91 | - * getIdentifier |
|
92 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
93 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
94 | - * |
|
95 | - * @param $object |
|
96 | - * @param mixed $identifier |
|
97 | - * @return bool |
|
98 | - */ |
|
99 | - public function getIdentifier($object, $identifier = null) |
|
100 | - { |
|
101 | - return ! empty($identifier) |
|
102 | - ? $identifier |
|
103 | - : get_class($object); |
|
104 | - } |
|
90 | + /** |
|
91 | + * getIdentifier |
|
92 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
93 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
94 | + * |
|
95 | + * @param $object |
|
96 | + * @param mixed $identifier |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | + public function getIdentifier($object, $identifier = null) |
|
100 | + { |
|
101 | + return ! empty($identifier) |
|
102 | + ? $identifier |
|
103 | + : get_class($object); |
|
104 | + } |
|
105 | 105 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | private function loadCollection() |
51 | 51 | { |
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
53 | 53 | $this->loader = new CollectionLoader( |
54 | 54 | new CollectionDetails( |
55 | 55 | // collection name |
@@ -49,7 +49,7 @@ |
||
49 | 49 | */ |
50 | 50 | private function loadCollection() |
51 | 51 | { |
52 | - if (! $this->loader instanceof CollectionLoader) { |
|
52 | + if ( ! $this->loader instanceof CollectionLoader) { |
|
53 | 53 | $this->loader = new CollectionLoader( |
54 | 54 | new CollectionDetails( |
55 | 55 | // collection name |
@@ -21,89 +21,89 @@ |
||
21 | 21 | class TypeCollection extends Collection |
22 | 22 | { |
23 | 23 | |
24 | - const COLLECTION_NAME = 'espresso_graphql_types'; |
|
24 | + const COLLECTION_NAME = 'espresso_graphql_types'; |
|
25 | 25 | |
26 | - const COLLECTION_INTERFACE = 'EventEspresso\core\services\graphql\types\TypeInterface'; |
|
26 | + const COLLECTION_INTERFACE = 'EventEspresso\core\services\graphql\types\TypeInterface'; |
|
27 | 27 | |
28 | - /** |
|
29 | - * @var CollectionLoader $loader |
|
30 | - */ |
|
31 | - protected $loader; |
|
28 | + /** |
|
29 | + * @var CollectionLoader $loader |
|
30 | + */ |
|
31 | + protected $loader; |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * TypeCollection constructor |
|
36 | - * |
|
37 | - * @throws InvalidInterfaceException |
|
38 | - */ |
|
39 | - public function __construct() |
|
40 | - { |
|
41 | - parent::__construct( |
|
42 | - TypeCollection::COLLECTION_INTERFACE, |
|
43 | - TypeCollection::COLLECTION_NAME |
|
44 | - ); |
|
45 | - } |
|
34 | + /** |
|
35 | + * TypeCollection constructor |
|
36 | + * |
|
37 | + * @throws InvalidInterfaceException |
|
38 | + */ |
|
39 | + public function __construct() |
|
40 | + { |
|
41 | + parent::__construct( |
|
42 | + TypeCollection::COLLECTION_INTERFACE, |
|
43 | + TypeCollection::COLLECTION_NAME |
|
44 | + ); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @throws CollectionDetailsException |
|
50 | - * @throws CollectionLoaderException |
|
51 | - * @since $VID:$ |
|
52 | - */ |
|
53 | - private function loadCollection() |
|
54 | - { |
|
55 | - if (! $this->loader instanceof CollectionLoader) { |
|
56 | - $this->loader = new CollectionLoader( |
|
57 | - new CollectionDetails( |
|
58 | - // collection name |
|
59 | - TypeCollection::COLLECTION_NAME, |
|
60 | - // collection interface |
|
61 | - TypeCollection::COLLECTION_INTERFACE, |
|
62 | - // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
63 | - apply_filters( |
|
64 | - 'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs', |
|
65 | - ['EventEspresso\core\domain\services\graphql\types'] |
|
66 | - ), |
|
67 | - // filepaths to classes to add |
|
68 | - array(), |
|
69 | - // file mask to use if parsing folder for files to add |
|
70 | - '', |
|
71 | - // what to use as identifier for collection entities |
|
72 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
73 | - CollectionDetails::ID_CLASS_NAME |
|
74 | - ), |
|
75 | - $this |
|
76 | - ); |
|
77 | - } |
|
78 | - } |
|
48 | + /** |
|
49 | + * @throws CollectionDetailsException |
|
50 | + * @throws CollectionLoaderException |
|
51 | + * @since $VID:$ |
|
52 | + */ |
|
53 | + private function loadCollection() |
|
54 | + { |
|
55 | + if (! $this->loader instanceof CollectionLoader) { |
|
56 | + $this->loader = new CollectionLoader( |
|
57 | + new CollectionDetails( |
|
58 | + // collection name |
|
59 | + TypeCollection::COLLECTION_NAME, |
|
60 | + // collection interface |
|
61 | + TypeCollection::COLLECTION_INTERFACE, |
|
62 | + // FQCNs for classes to add (all classes within each namespace will be loaded) |
|
63 | + apply_filters( |
|
64 | + 'FHEE__EventEspresso_core_services_graphql_TypeCollection__loadCollection__collection_FQCNs', |
|
65 | + ['EventEspresso\core\domain\services\graphql\types'] |
|
66 | + ), |
|
67 | + // filepaths to classes to add |
|
68 | + array(), |
|
69 | + // file mask to use if parsing folder for files to add |
|
70 | + '', |
|
71 | + // what to use as identifier for collection entities |
|
72 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
73 | + CollectionDetails::ID_CLASS_NAME |
|
74 | + ), |
|
75 | + $this |
|
76 | + ); |
|
77 | + } |
|
78 | + } |
|
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * @return CollectionInterface |
|
83 | - * @throws CollectionDetailsException |
|
84 | - * @throws CollectionLoaderException |
|
85 | - * @since $VID:$ |
|
86 | - */ |
|
87 | - public function loadTypes() |
|
88 | - { |
|
89 | - $this->loadCollection(); |
|
90 | - return $this->loader->getCollection(); |
|
91 | - } |
|
81 | + /** |
|
82 | + * @return CollectionInterface |
|
83 | + * @throws CollectionDetailsException |
|
84 | + * @throws CollectionLoaderException |
|
85 | + * @since $VID:$ |
|
86 | + */ |
|
87 | + public function loadTypes() |
|
88 | + { |
|
89 | + $this->loadCollection(); |
|
90 | + return $this->loader->getCollection(); |
|
91 | + } |
|
92 | 92 | |
93 | 93 | |
94 | - /** |
|
95 | - * getIdentifier |
|
96 | - * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
97 | - * If no $identifier is supplied, then the fully qualified class name is used |
|
98 | - * |
|
99 | - * @param $object |
|
100 | - * @param mixed $identifier |
|
101 | - * @return bool |
|
102 | - */ |
|
103 | - public function getIdentifier($object, $identifier = null) |
|
104 | - { |
|
105 | - return ! empty($identifier) |
|
106 | - ? $identifier |
|
107 | - : get_class($object); |
|
108 | - } |
|
94 | + /** |
|
95 | + * getIdentifier |
|
96 | + * Overrides EventEspresso\core\services\collections\Collection::getIdentifier() |
|
97 | + * If no $identifier is supplied, then the fully qualified class name is used |
|
98 | + * |
|
99 | + * @param $object |
|
100 | + * @param mixed $identifier |
|
101 | + * @return bool |
|
102 | + */ |
|
103 | + public function getIdentifier($object, $identifier = null) |
|
104 | + { |
|
105 | + return ! empty($identifier) |
|
106 | + ? $identifier |
|
107 | + : get_class($object); |
|
108 | + } |
|
109 | 109 | } |
@@ -68,7 +68,7 @@ |
||
68 | 68 | $inputFields = []; |
69 | 69 | foreach ($input->fields() as $field) { |
70 | 70 | $fieldName = $field->name(); |
71 | - $inputFields[ $fieldName ] = $field->toArray(); |
|
71 | + $inputFields[$fieldName] = $field->toArray(); |
|
72 | 72 | } |
73 | 73 | // Register the input type. |
74 | 74 | register_graphql_input_type( |
@@ -18,65 +18,65 @@ |
||
18 | 18 | class InputsManager implements GQLManagerInterface |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * @var InputCollection|InputInterface[] $inputs |
|
23 | - */ |
|
24 | - private $inputs; |
|
21 | + /** |
|
22 | + * @var InputCollection|InputInterface[] $inputs |
|
23 | + */ |
|
24 | + private $inputs; |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * InputsManager constructor. |
|
29 | - * |
|
30 | - * @param InputCollection|InputInterface[] $inputs |
|
31 | - */ |
|
32 | - public function __construct(InputCollection $inputs) |
|
33 | - { |
|
34 | - $this->inputs = $inputs; |
|
35 | - } |
|
27 | + /** |
|
28 | + * InputsManager constructor. |
|
29 | + * |
|
30 | + * @param InputCollection|InputInterface[] $inputs |
|
31 | + */ |
|
32 | + public function __construct(InputCollection $inputs) |
|
33 | + { |
|
34 | + $this->inputs = $inputs; |
|
35 | + } |
|
36 | 36 | |
37 | 37 | |
38 | - /** |
|
39 | - * @throws CollectionDetailsException |
|
40 | - * @throws CollectionLoaderException |
|
41 | - * @since $VID:$ |
|
42 | - */ |
|
43 | - public function init() |
|
44 | - { |
|
45 | - $this->inputs->loadInputs(); |
|
46 | - add_action('graphql_register_types', [$this, 'configureInputs'], 9); |
|
47 | - } |
|
38 | + /** |
|
39 | + * @throws CollectionDetailsException |
|
40 | + * @throws CollectionLoaderException |
|
41 | + * @since $VID:$ |
|
42 | + */ |
|
43 | + public function init() |
|
44 | + { |
|
45 | + $this->inputs->loadInputs(); |
|
46 | + add_action('graphql_register_types', [$this, 'configureInputs'], 9); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | |
50 | - /** |
|
51 | - * @since $VID:$ |
|
52 | - */ |
|
53 | - public function configureInputs() |
|
54 | - { |
|
55 | - // loop through the collection of inputs and register their fields |
|
56 | - foreach ($this->inputs as $input) { |
|
57 | - $this->registerInput($input); |
|
58 | - } |
|
59 | - } |
|
50 | + /** |
|
51 | + * @since $VID:$ |
|
52 | + */ |
|
53 | + public function configureInputs() |
|
54 | + { |
|
55 | + // loop through the collection of inputs and register their fields |
|
56 | + foreach ($this->inputs as $input) { |
|
57 | + $this->registerInput($input); |
|
58 | + } |
|
59 | + } |
|
60 | 60 | |
61 | 61 | |
62 | - /** |
|
63 | - * @param InputInterface $input |
|
64 | - * @since $VID:$ |
|
65 | - */ |
|
66 | - public function registerInput(InputInterface $input) |
|
67 | - { |
|
68 | - $inputFields = []; |
|
69 | - foreach ($input->fields() as $field) { |
|
70 | - $fieldName = $field->name(); |
|
71 | - $inputFields[ $fieldName ] = $field->toArray(); |
|
72 | - } |
|
73 | - // Register the input type. |
|
74 | - register_graphql_input_type( |
|
75 | - $input->name(), |
|
76 | - [ |
|
77 | - 'description' => $input->description(), |
|
78 | - 'fields' => $inputFields, |
|
79 | - ] |
|
80 | - ); |
|
81 | - } |
|
62 | + /** |
|
63 | + * @param InputInterface $input |
|
64 | + * @since $VID:$ |
|
65 | + */ |
|
66 | + public function registerInput(InputInterface $input) |
|
67 | + { |
|
68 | + $inputFields = []; |
|
69 | + foreach ($input->fields() as $field) { |
|
70 | + $fieldName = $field->name(); |
|
71 | + $inputFields[ $fieldName ] = $field->toArray(); |
|
72 | + } |
|
73 | + // Register the input type. |
|
74 | + register_graphql_input_type( |
|
75 | + $input->name(), |
|
76 | + [ |
|
77 | + 'description' => $input->description(), |
|
78 | + 'fields' => $inputFields, |
|
79 | + ] |
|
80 | + ); |
|
81 | + } |
|
82 | 82 | } |