Completed
Branch fix/events-archive-config-rese... (0ef832)
by
unknown
12:05 queued 09:36
created
core/services/dependencies/DependencyResolver.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public function addAlias(ClassAlias $alias)
99 99
     {
100
-        $this->aliases[ $alias->alias() ] = $alias;
100
+        $this->aliases[$alias->alias()] = $alias;
101 101
     }
102 102
 
103 103
     /**
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      */
107 107
     public function resolveAlias($param_fqcn)
108 108
     {
109
-        return isset($this->aliases[ $param_fqcn ])
110
-            ? $this->aliases[ $param_fqcn ]->fqcn()
109
+        return isset($this->aliases[$param_fqcn])
110
+            ? $this->aliases[$param_fqcn]->fqcn()
111 111
             : $this->classCache()->getFqnForAlias($param_fqcn);
112 112
     }
113 113
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
                 $this->resolveDependenciesForClass($param_class);
171 171
             }
172 172
             $param_class = $this->resolveAlias($param_class);
173
-            $dependencies[ $param_class ] = EE_Dependency_Map::load_from_cache;
173
+            $dependencies[$param_class] = EE_Dependency_Map::load_from_cache;
174 174
         }
175 175
         $this->dependencyMap()->registerDependencies($fqcn, $dependencies);
176 176
     }
Please login to merge, or discard this patch.
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -23,155 +23,155 @@
 block discarded – undo
23 23
 abstract class DependencyResolver implements DependencyResolverInterface
24 24
 {
25 25
 
26
-    /**
27
-     * @var Mirror $mirror
28
-     */
29
-    private $mirror;
30
-
31
-    /**
32
-     * @var ClassInterfaceCache $class_cache
33
-     */
34
-    private $class_cache;
35
-
36
-    /**
37
-     * @var EE_Dependency_Map $dependency_map
38
-     */
39
-    private $dependency_map;
40
-
41
-    /**
42
-     * @var ClassAlias[] $aliases
43
-     */
44
-    protected $aliases = array();
45
-
46
-    /**
47
-     * @var array $namespace_roots
48
-     */
49
-    protected $namespace_roots = array();
50
-
51
-
52
-    /**
53
-     * RouteMatchSpecificationDependencyResolver constructor.
54
-     *
55
-     * @param Mirror              $mirror
56
-     * @param ClassInterfaceCache $class_cache
57
-     * @param EE_Dependency_Map   $dependency_map
58
-     */
59
-    public function __construct(
60
-        Mirror $mirror,
61
-        ClassInterfaceCache $class_cache,
62
-        EE_Dependency_Map $dependency_map
63
-    ) {
64
-        $this->mirror = $mirror;
65
-        $this->class_cache = $class_cache;
66
-        $this->dependency_map = $dependency_map;
67
-        $this->initialize();
68
-    }
69
-
70
-    /**
71
-     * @return Mirror
72
-     */
73
-    public function mirror()
74
-    {
75
-        return $this->mirror;
76
-    }
77
-
78
-    /**
79
-     * @return ClassInterfaceCache
80
-     */
81
-    public function classCache()
82
-    {
83
-        return $this->class_cache;
84
-    }
85
-
86
-    /**
87
-     * @return EE_Dependency_Map
88
-     */
89
-    public function dependencyMap()
90
-    {
91
-        return $this->dependency_map;
92
-    }
93
-
94
-    /**
95
-     * @param ClassAlias $alias
96
-     * @throws InvalidAliasException
97
-     */
98
-    public function addAlias(ClassAlias $alias)
99
-    {
100
-        $this->aliases[ $alias->alias() ] = $alias;
101
-    }
102
-
103
-    /**
104
-     * @param string $param_fqcn Fully Qualified Class Name for dependency parameter
105
-     * @return string
106
-     */
107
-    public function resolveAlias($param_fqcn)
108
-    {
109
-        return isset($this->aliases[ $param_fqcn ])
110
-            ? $this->aliases[ $param_fqcn ]->fqcn()
111
-            : $this->classCache()->getFqnForAlias($param_fqcn);
112
-    }
113
-
114
-    /**
115
-     * Primarily used to indicate the namespace root for composite objects
116
-     * so that dependencies requiring the same DependencyResolver can be acquired
117
-     * for example:
118
-     * Vendor\path\to\class\A, Vendor\path\to\class\B, and Vendor\path\to\class\C
119
-     * may all implement Vendor\path\to\Interface,
120
-     * but Vendor\path\to\class\C could be a composite object
121
-     * that requires Vendor\path\to\class\A and Vendor\path\to\class\B,
122
-     * and needs both of those dependencies resolved, which would therefore require
123
-     * the use of the same DependencyResolver.
124
-     *
125
-     * By specifying a namespace root of "Vendor\path\to\",
126
-     * then all classes that are descendants of that namespace
127
-     * will use DependencyResolver to acquire the classes they need
128
-     *
129
-     * @param string $namespace_root Partial namespace used for detecting other classes
130
-     *                               that should employ this same DependencyResolver
131
-     */
132
-    public function addNamespaceRoot($namespace_root)
133
-    {
134
-        $this->namespace_roots[] = $namespace_root;
135
-    }
136
-
137
-    /**
138
-     * Returns true if the parameter FQCN belongs to one of
139
-     * the namespaces that utilizes this DependencyResolver
140
-     *
141
-     * @param string $param_fqcn Fully Qualified Class Name for dependency parameter
142
-     * @return boolean
143
-     * @since 4.9.71.p
144
-     */
145
-    public function dependencyRecursionExists($param_fqcn)
146
-    {
147
-        foreach ($this->namespace_roots as $namespace_root) {
148
-            if (strpos($param_fqcn, $namespace_root) !== false) {
149
-                return true;
150
-            }
151
-        }
152
-        return false;
153
-    }
154
-
155
-
156
-    /**
157
-     * @param string $fqcn Fully Qualified Class Name
158
-     * @throws InvalidDataTypeException
159
-     * @throws ReflectionException
160
-     * @since 4.9.71.p
161
-     */
162
-    public function resolveDependenciesForClass($fqcn)
163
-    {
164
-        $dependencies = array();
165
-        $params = $this->mirror()->getParameters($fqcn);
166
-        foreach ($params as $index => $param) {
167
-            // is this a dependency for a specific class ?
168
-            $param_class = $this->mirror()->getParameterClassName($param, $fqcn, $index);
169
-            if ($this->dependencyRecursionExists($param_class)) {
170
-                $this->resolveDependenciesForClass($param_class);
171
-            }
172
-            $param_class = $this->resolveAlias($param_class);
173
-            $dependencies[ $param_class ] = EE_Dependency_Map::load_from_cache;
174
-        }
175
-        $this->dependencyMap()->registerDependencies($fqcn, $dependencies);
176
-    }
26
+	/**
27
+	 * @var Mirror $mirror
28
+	 */
29
+	private $mirror;
30
+
31
+	/**
32
+	 * @var ClassInterfaceCache $class_cache
33
+	 */
34
+	private $class_cache;
35
+
36
+	/**
37
+	 * @var EE_Dependency_Map $dependency_map
38
+	 */
39
+	private $dependency_map;
40
+
41
+	/**
42
+	 * @var ClassAlias[] $aliases
43
+	 */
44
+	protected $aliases = array();
45
+
46
+	/**
47
+	 * @var array $namespace_roots
48
+	 */
49
+	protected $namespace_roots = array();
50
+
51
+
52
+	/**
53
+	 * RouteMatchSpecificationDependencyResolver constructor.
54
+	 *
55
+	 * @param Mirror              $mirror
56
+	 * @param ClassInterfaceCache $class_cache
57
+	 * @param EE_Dependency_Map   $dependency_map
58
+	 */
59
+	public function __construct(
60
+		Mirror $mirror,
61
+		ClassInterfaceCache $class_cache,
62
+		EE_Dependency_Map $dependency_map
63
+	) {
64
+		$this->mirror = $mirror;
65
+		$this->class_cache = $class_cache;
66
+		$this->dependency_map = $dependency_map;
67
+		$this->initialize();
68
+	}
69
+
70
+	/**
71
+	 * @return Mirror
72
+	 */
73
+	public function mirror()
74
+	{
75
+		return $this->mirror;
76
+	}
77
+
78
+	/**
79
+	 * @return ClassInterfaceCache
80
+	 */
81
+	public function classCache()
82
+	{
83
+		return $this->class_cache;
84
+	}
85
+
86
+	/**
87
+	 * @return EE_Dependency_Map
88
+	 */
89
+	public function dependencyMap()
90
+	{
91
+		return $this->dependency_map;
92
+	}
93
+
94
+	/**
95
+	 * @param ClassAlias $alias
96
+	 * @throws InvalidAliasException
97
+	 */
98
+	public function addAlias(ClassAlias $alias)
99
+	{
100
+		$this->aliases[ $alias->alias() ] = $alias;
101
+	}
102
+
103
+	/**
104
+	 * @param string $param_fqcn Fully Qualified Class Name for dependency parameter
105
+	 * @return string
106
+	 */
107
+	public function resolveAlias($param_fqcn)
108
+	{
109
+		return isset($this->aliases[ $param_fqcn ])
110
+			? $this->aliases[ $param_fqcn ]->fqcn()
111
+			: $this->classCache()->getFqnForAlias($param_fqcn);
112
+	}
113
+
114
+	/**
115
+	 * Primarily used to indicate the namespace root for composite objects
116
+	 * so that dependencies requiring the same DependencyResolver can be acquired
117
+	 * for example:
118
+	 * Vendor\path\to\class\A, Vendor\path\to\class\B, and Vendor\path\to\class\C
119
+	 * may all implement Vendor\path\to\Interface,
120
+	 * but Vendor\path\to\class\C could be a composite object
121
+	 * that requires Vendor\path\to\class\A and Vendor\path\to\class\B,
122
+	 * and needs both of those dependencies resolved, which would therefore require
123
+	 * the use of the same DependencyResolver.
124
+	 *
125
+	 * By specifying a namespace root of "Vendor\path\to\",
126
+	 * then all classes that are descendants of that namespace
127
+	 * will use DependencyResolver to acquire the classes they need
128
+	 *
129
+	 * @param string $namespace_root Partial namespace used for detecting other classes
130
+	 *                               that should employ this same DependencyResolver
131
+	 */
132
+	public function addNamespaceRoot($namespace_root)
133
+	{
134
+		$this->namespace_roots[] = $namespace_root;
135
+	}
136
+
137
+	/**
138
+	 * Returns true if the parameter FQCN belongs to one of
139
+	 * the namespaces that utilizes this DependencyResolver
140
+	 *
141
+	 * @param string $param_fqcn Fully Qualified Class Name for dependency parameter
142
+	 * @return boolean
143
+	 * @since 4.9.71.p
144
+	 */
145
+	public function dependencyRecursionExists($param_fqcn)
146
+	{
147
+		foreach ($this->namespace_roots as $namespace_root) {
148
+			if (strpos($param_fqcn, $namespace_root) !== false) {
149
+				return true;
150
+			}
151
+		}
152
+		return false;
153
+	}
154
+
155
+
156
+	/**
157
+	 * @param string $fqcn Fully Qualified Class Name
158
+	 * @throws InvalidDataTypeException
159
+	 * @throws ReflectionException
160
+	 * @since 4.9.71.p
161
+	 */
162
+	public function resolveDependenciesForClass($fqcn)
163
+	{
164
+		$dependencies = array();
165
+		$params = $this->mirror()->getParameters($fqcn);
166
+		foreach ($params as $index => $param) {
167
+			// is this a dependency for a specific class ?
168
+			$param_class = $this->mirror()->getParameterClassName($param, $fqcn, $index);
169
+			if ($this->dependencyRecursionExists($param_class)) {
170
+				$this->resolveDependenciesForClass($param_class);
171
+			}
172
+			$param_class = $this->resolveAlias($param_class);
173
+			$dependencies[ $param_class ] = EE_Dependency_Map::load_from_cache;
174
+		}
175
+		$this->dependencyMap()->registerDependencies($fqcn, $dependencies);
176
+	}
177 177
 }
Please login to merge, or discard this patch.
core/domain/entities/route_match/MultiRouteSpecification.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -16,29 +16,29 @@
 block discarded – undo
16 16
 abstract class MultiRouteSpecification extends RouteMatchSpecification
17 17
 {
18 18
 
19
-    /**
20
-     * @var RouteMatchSpecificationInterface[] $specifications
21
-     */
22
-    protected $specifications;
19
+	/**
20
+	 * @var RouteMatchSpecificationInterface[] $specifications
21
+	 */
22
+	protected $specifications;
23 23
 
24
-    /**
25
-     * MultiRouteSpecification constructor.
26
-     *
27
-     * @param RouteMatchSpecificationInterface[] $specifications
28
-     * @param RequestInterface                   $request
29
-     * @throws InvalidEntityException
30
-     */
31
-    public function __construct(array $specifications, RequestInterface $request)
32
-    {
33
-        foreach ($specifications as $specification) {
34
-            if (! $specification instanceof RouteMatchSpecificationInterface) {
35
-                throw new InvalidEntityException(
36
-                    $specification,
37
-                    'EventEspresso\core\domain\entities\route_match\RouteMatchSpecificationInterface'
38
-                );
39
-            }
40
-        }
41
-        $this->specifications = $specifications;
42
-        parent::__construct($request);
43
-    }
24
+	/**
25
+	 * MultiRouteSpecification constructor.
26
+	 *
27
+	 * @param RouteMatchSpecificationInterface[] $specifications
28
+	 * @param RequestInterface                   $request
29
+	 * @throws InvalidEntityException
30
+	 */
31
+	public function __construct(array $specifications, RequestInterface $request)
32
+	{
33
+		foreach ($specifications as $specification) {
34
+			if (! $specification instanceof RouteMatchSpecificationInterface) {
35
+				throw new InvalidEntityException(
36
+					$specification,
37
+					'EventEspresso\core\domain\entities\route_match\RouteMatchSpecificationInterface'
38
+				);
39
+			}
40
+		}
41
+		$this->specifications = $specifications;
42
+		parent::__construct($request);
43
+	}
44 44
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
     public function __construct(array $specifications, RequestInterface $request)
32 32
     {
33 33
         foreach ($specifications as $specification) {
34
-            if (! $specification instanceof RouteMatchSpecificationInterface) {
34
+            if ( ! $specification instanceof RouteMatchSpecificationInterface) {
35 35
                 throw new InvalidEntityException(
36 36
                     $specification,
37 37
                     'EventEspresso\core\domain\entities\route_match\RouteMatchSpecificationInterface'
Please login to merge, or discard this patch.
core/services/request/middleware/DetectFileEditorRequest.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -17,23 +17,23 @@
 block discarded – undo
17 17
 class DetectFileEditorRequest extends Middleware
18 18
 {
19 19
 
20
-    /**
21
-     * converts a Request to a Response
22
-     *
23
-     * @param RequestInterface  $request
24
-     * @param ResponseInterface $response
25
-     * @return ResponseInterface
26
-     */
27
-    public function handleRequest(RequestInterface $request, ResponseInterface $response)
28
-    {
29
-        $this->request  = $request;
30
-        $this->response = $response;
31
-        // can't store user data during WP error scrapes if no user exists
32
-        // so don't load the session since it's not going to work anyways
33
-        if ($this->request->isWordPressScrape()) {
34
-            add_filter('FHEE_load_EE_Session', '__return_false', 999);
35
-        }
36
-        $this->response = $this->processRequestStack($this->request, $this->response);
37
-        return $this->response;
38
-    }
20
+	/**
21
+	 * converts a Request to a Response
22
+	 *
23
+	 * @param RequestInterface  $request
24
+	 * @param ResponseInterface $response
25
+	 * @return ResponseInterface
26
+	 */
27
+	public function handleRequest(RequestInterface $request, ResponseInterface $response)
28
+	{
29
+		$this->request  = $request;
30
+		$this->response = $response;
31
+		// can't store user data during WP error scrapes if no user exists
32
+		// so don't load the session since it's not going to work anyways
33
+		if ($this->request->isWordPressScrape()) {
34
+			add_filter('FHEE_load_EE_Session', '__return_false', 999);
35
+		}
36
+		$this->response = $this->processRequestStack($this->request, $this->response);
37
+		return $this->response;
38
+	}
39 39
 }
Please login to merge, or discard this patch.
domain/entities/route_match/specifications/admin/WordPressPostsEditor.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,22 +18,22 @@
 block discarded – undo
18 18
  */
19 19
 class WordPressPostsEditor extends MatchAnyRouteSpecification
20 20
 {
21
-    /**
22
-     * WordPressPostsEditor constructor.
23
-     *
24
-     * @param WordPressPostsEditorEdit $edit_post_route_match
25
-     * @param WordPressPostsEditorAddNew $create_post_route_match
26
-     * @param RequestInterface           $request
27
-     * @throws \EventEspresso\core\exceptions\InvalidEntityException
28
-     */
29
-    public function __construct(
30
-        WordPressPostsEditorEdit $edit_post_route_match,
31
-        WordPressPostsEditorAddNew $create_post_route_match,
32
-        RequestInterface $request
33
-    ) {
34
-        parent::__construct(
35
-            array($edit_post_route_match, $create_post_route_match),
36
-            $request
37
-        );
38
-    }
21
+	/**
22
+	 * WordPressPostsEditor constructor.
23
+	 *
24
+	 * @param WordPressPostsEditorEdit $edit_post_route_match
25
+	 * @param WordPressPostsEditorAddNew $create_post_route_match
26
+	 * @param RequestInterface           $request
27
+	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
28
+	 */
29
+	public function __construct(
30
+		WordPressPostsEditorEdit $edit_post_route_match,
31
+		WordPressPostsEditorAddNew $create_post_route_match,
32
+		RequestInterface $request
33
+	) {
34
+		parent::__construct(
35
+			array($edit_post_route_match, $create_post_route_match),
36
+			$request
37
+		);
38
+	}
39 39
 }
Please login to merge, or discard this patch.
domain/entities/route_match/specifications/admin/EspressoEventEditor.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@
 block discarded – undo
19 19
  */
20 20
 class EspressoEventEditor extends MatchAnyRouteSpecification
21 21
 {
22
-    /**
23
-     * EspressoEventEditor constructor.
24
-     *
25
-     * @param EspressoEventEditorEdit   $edit_event_route_match
26
-     * @param EspressoEventEditorAddNew $create_event_route_match
27
-     * @param RequestInterface          $request
28
-     * @throws InvalidEntityException
29
-     */
30
-    public function __construct(
31
-        EspressoEventEditorEdit $edit_event_route_match,
32
-        EspressoEventEditorAddNew $create_event_route_match,
33
-        RequestInterface $request
34
-    ) {
35
-        parent::__construct(
36
-            array($edit_event_route_match, $create_event_route_match),
37
-            $request
38
-        );
39
-    }
22
+	/**
23
+	 * EspressoEventEditor constructor.
24
+	 *
25
+	 * @param EspressoEventEditorEdit   $edit_event_route_match
26
+	 * @param EspressoEventEditorAddNew $create_event_route_match
27
+	 * @param RequestInterface          $request
28
+	 * @throws InvalidEntityException
29
+	 */
30
+	public function __construct(
31
+		EspressoEventEditorEdit $edit_event_route_match,
32
+		EspressoEventEditorAddNew $create_event_route_match,
33
+		RequestInterface $request
34
+	) {
35
+		parent::__construct(
36
+			array($edit_event_route_match, $create_event_route_match),
37
+			$request
38
+		);
39
+	}
40 40
 }
Please login to merge, or discard this patch.
domain/entities/route_match/specifications/admin/EspressoVenueEditor.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@
 block discarded – undo
19 19
  */
20 20
 class EspressoVenueEditor extends MatchAnyRouteSpecification
21 21
 {
22
-    /**
23
-     * EspressoVenueEditor constructor.
24
-     *
25
-     * @param EspressoVenueEditorEdit $edit_venue_route_match
26
-     * @param EspressoVenueEditorAddNew $create_venue_route_match
27
-     * @param RequestInterface          $request
28
-     * @throws InvalidEntityException
29
-     */
30
-    public function __construct(
31
-        EspressoVenueEditorEdit $edit_venue_route_match,
32
-        EspressoVenueEditorAddNew $create_venue_route_match,
33
-        RequestInterface $request
34
-    ) {
35
-        parent::__construct(
36
-            array($edit_venue_route_match, $create_venue_route_match),
37
-            $request
38
-        );
39
-    }
22
+	/**
23
+	 * EspressoVenueEditor constructor.
24
+	 *
25
+	 * @param EspressoVenueEditorEdit $edit_venue_route_match
26
+	 * @param EspressoVenueEditorAddNew $create_venue_route_match
27
+	 * @param RequestInterface          $request
28
+	 * @throws InvalidEntityException
29
+	 */
30
+	public function __construct(
31
+		EspressoVenueEditorEdit $edit_venue_route_match,
32
+		EspressoVenueEditorAddNew $create_venue_route_match,
33
+		RequestInterface $request
34
+	) {
35
+		parent::__construct(
36
+			array($edit_venue_route_match, $create_venue_route_match),
37
+			$request
38
+		);
39
+	}
40 40
 }
Please login to merge, or discard this patch.
domain/entities/route_match/specifications/admin/EspressoPostTypeEditor.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,22 +18,22 @@
 block discarded – undo
18 18
  */
19 19
 class EspressoPostTypeEditor extends MatchAnyRouteSpecification
20 20
 {
21
-    /**
22
-     * EspressoEventEditor constructor.
23
-     *
24
-     * @param EspressoStandardPostTypeEditor $standard_route_match
25
-     * @param EspressoAttendeePostTypeEditor $attendee_route_match
26
-     * @param RequestInterface          $request
27
-     * @throws InvalidEntityException
28
-     */
29
-    public function __construct(
30
-        EspressoStandardPostTypeEditor $standard_route_match,
31
-        EspressoAttendeePostTypeEditor $attendee_route_match,
32
-        RequestInterface $request
33
-    ) {
34
-        parent::__construct(
35
-            array($standard_route_match, $attendee_route_match),
36
-            $request
37
-        );
38
-    }
21
+	/**
22
+	 * EspressoEventEditor constructor.
23
+	 *
24
+	 * @param EspressoStandardPostTypeEditor $standard_route_match
25
+	 * @param EspressoAttendeePostTypeEditor $attendee_route_match
26
+	 * @param RequestInterface          $request
27
+	 * @throws InvalidEntityException
28
+	 */
29
+	public function __construct(
30
+		EspressoStandardPostTypeEditor $standard_route_match,
31
+		EspressoAttendeePostTypeEditor $attendee_route_match,
32
+		RequestInterface $request
33
+	) {
34
+		parent::__construct(
35
+			array($standard_route_match, $attendee_route_match),
36
+			$request
37
+		);
38
+	}
39 39
 }
Please login to merge, or discard this patch.
domain/entities/route_match/specifications/admin/WordPressPageEditor.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,22 +18,22 @@
 block discarded – undo
18 18
  */
19 19
 class WordPressPageEditor extends MatchAnyRouteSpecification
20 20
 {
21
-    /**
22
-     * WordPressPostsEditor constructor.
23
-     *
24
-     * @param WordPressPostsEditorEdit $edit_page_route_match
25
-     * @param WordPressPostsEditorAddNew $create_page_route_match
26
-     * @param RequestInterface           $request
27
-     * @throws \EventEspresso\core\exceptions\InvalidEntityException
28
-     */
29
-    public function __construct(
30
-        WordPressPageEditorEdit $edit_page_route_match,
31
-        WordPressPageEditorAddNew $create_page_route_match,
32
-        RequestInterface $request
33
-    ) {
34
-        parent::__construct(
35
-            array($edit_page_route_match, $create_page_route_match),
36
-            $request
37
-        );
38
-    }
21
+	/**
22
+	 * WordPressPostsEditor constructor.
23
+	 *
24
+	 * @param WordPressPostsEditorEdit $edit_page_route_match
25
+	 * @param WordPressPostsEditorAddNew $create_page_route_match
26
+	 * @param RequestInterface           $request
27
+	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
28
+	 */
29
+	public function __construct(
30
+		WordPressPageEditorEdit $edit_page_route_match,
31
+		WordPressPageEditorAddNew $create_page_route_match,
32
+		RequestInterface $request
33
+	) {
34
+		parent::__construct(
35
+			array($edit_page_route_match, $create_page_route_match),
36
+			$request
37
+		);
38
+	}
39 39
 }
Please login to merge, or discard this patch.
core/entities/models/JsonModelSchema.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -76,22 +76,22 @@  discard block
 block discarded – undo
76 76
     public function getModelSchemaForFields(array $model_fields, array $schema)
77 77
     {
78 78
         foreach ($model_fields as $field => $model_field) {
79
-            if (! $model_field instanceof EE_Model_Field_Base) {
79
+            if ( ! $model_field instanceof EE_Model_Field_Base) {
80 80
                 continue;
81 81
             }
82
-            $schema['properties'][ $field ] = $model_field->getSchema();
82
+            $schema['properties'][$field] = $model_field->getSchema();
83 83
 
84 84
             // if this is a primary key field add the primary key item
85 85
             if ($model_field instanceof EE_Primary_Key_Field_Base) {
86
-                $schema['properties'][ $field ]['primary_key'] = true;
86
+                $schema['properties'][$field]['primary_key'] = true;
87 87
                 if ($model_field instanceof EE_Primary_Key_Int_Field) {
88
-                    $schema['properties'][ $field ]['readonly'] = true;
88
+                    $schema['properties'][$field]['readonly'] = true;
89 89
                 }
90 90
             }
91 91
 
92 92
             // if this is a foreign key field add the foreign key item
93 93
             if ($model_field instanceof EE_Foreign_Key_Field_Base) {
94
-                $schema['properties'][ $field ]['foreign_key'] = array(
94
+                $schema['properties'][$field]['foreign_key'] = array(
95 95
                     'description' => esc_html__(
96 96
                         'This is a foreign key the points to the given models.',
97 97
                         'event_espresso'
@@ -115,18 +115,18 @@  discard block
 block discarded – undo
115 115
     public function getModelSchemaForRelations(array $relations_on_model, array $schema)
116 116
     {
117 117
         foreach ($relations_on_model as $model_name => $relation) {
118
-            if (! $relation instanceof EE_Model_Relation_Base) {
118
+            if ( ! $relation instanceof EE_Model_Relation_Base) {
119 119
                 continue;
120 120
             }
121 121
             $model_name_for_schema = $relation instanceof EE_Belongs_To_Relation
122 122
                 ? strtolower($model_name)
123 123
                 : EEH_Inflector::pluralize_and_lower($model_name);
124
-            $schema['properties'][ $model_name_for_schema ] = $relation->getSchema();
125
-            $schema['properties'][ $model_name_for_schema ]['relation_model'] = $model_name;
124
+            $schema['properties'][$model_name_for_schema] = $relation->getSchema();
125
+            $schema['properties'][$model_name_for_schema]['relation_model'] = $model_name;
126 126
 
127 127
             // links schema
128
-            $links_key = 'https://api.eventespresso.com/' . strtolower($model_name);
129
-            $schema['properties']['_links']['properties'][ $links_key ] = array(
128
+            $links_key = 'https://api.eventespresso.com/'.strtolower($model_name);
129
+            $schema['properties']['_links']['properties'][$links_key] = array(
130 130
                 'description' => esc_html__(
131 131
                     'Array of objects describing the link(s) for this relation resource.',
132 132
                     'event_espresso'
Please login to merge, or discard this patch.
Indentation   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -25,255 +25,255 @@
 block discarded – undo
25 25
 class JsonModelSchema
26 26
 {
27 27
 
28
-    /**
29
-     * @var EEM_Base
30
-     */
31
-    protected $model;
28
+	/**
29
+	 * @var EEM_Base
30
+	 */
31
+	protected $model;
32 32
 
33
-    /**
34
-     * @var CalculatedModelFields
35
-     */
36
-    protected $fields_calculator;
33
+	/**
34
+	 * @var CalculatedModelFields
35
+	 */
36
+	protected $fields_calculator;
37 37
 
38 38
 
39
-    /**
40
-     * JsonModelSchema constructor.
41
-     *
42
-     * @param EEM_Base              $model
43
-     * @param CalculatedModelFields $fields_calculator
44
-     */
45
-    public function __construct(EEM_Base $model, CalculatedModelFields $fields_calculator)
46
-    {
47
-        $this->model = $model;
48
-        $this->fields_calculator = $fields_calculator;
49
-    }
39
+	/**
40
+	 * JsonModelSchema constructor.
41
+	 *
42
+	 * @param EEM_Base              $model
43
+	 * @param CalculatedModelFields $fields_calculator
44
+	 */
45
+	public function __construct(EEM_Base $model, CalculatedModelFields $fields_calculator)
46
+	{
47
+		$this->model = $model;
48
+		$this->fields_calculator = $fields_calculator;
49
+	}
50 50
 
51 51
 
52
-    /**
53
-     * Return the schema for a given model from a given model.
54
-     *
55
-     * @return array
56
-     */
57
-    public function getModelSchema()
58
-    {
59
-        return $this->getModelSchemaForRelations(
60
-            $this->model->relation_settings(),
61
-            $this->getModelSchemaForFields(
62
-                $this->model->field_settings(),
63
-                $this->getInitialSchemaStructure()
64
-            )
65
-        );
66
-    }
52
+	/**
53
+	 * Return the schema for a given model from a given model.
54
+	 *
55
+	 * @return array
56
+	 */
57
+	public function getModelSchema()
58
+	{
59
+		return $this->getModelSchemaForRelations(
60
+			$this->model->relation_settings(),
61
+			$this->getModelSchemaForFields(
62
+				$this->model->field_settings(),
63
+				$this->getInitialSchemaStructure()
64
+			)
65
+		);
66
+	}
67 67
 
68 68
 
69
-    /**
70
-     * Get the schema for a given set of model fields.
71
-     *
72
-     * @param EE_Model_Field_Base[] $model_fields
73
-     * @param array                  $schema
74
-     * @return array
75
-     */
76
-    public function getModelSchemaForFields(array $model_fields, array $schema)
77
-    {
78
-        foreach ($model_fields as $field => $model_field) {
79
-            if (! $model_field instanceof EE_Model_Field_Base) {
80
-                continue;
81
-            }
82
-            $schema['properties'][ $field ] = $model_field->getSchema();
69
+	/**
70
+	 * Get the schema for a given set of model fields.
71
+	 *
72
+	 * @param EE_Model_Field_Base[] $model_fields
73
+	 * @param array                  $schema
74
+	 * @return array
75
+	 */
76
+	public function getModelSchemaForFields(array $model_fields, array $schema)
77
+	{
78
+		foreach ($model_fields as $field => $model_field) {
79
+			if (! $model_field instanceof EE_Model_Field_Base) {
80
+				continue;
81
+			}
82
+			$schema['properties'][ $field ] = $model_field->getSchema();
83 83
 
84
-            // if this is a primary key field add the primary key item
85
-            if ($model_field instanceof EE_Primary_Key_Field_Base) {
86
-                $schema['properties'][ $field ]['primary_key'] = true;
87
-                if ($model_field instanceof EE_Primary_Key_Int_Field) {
88
-                    $schema['properties'][ $field ]['readonly'] = true;
89
-                }
90
-            }
84
+			// if this is a primary key field add the primary key item
85
+			if ($model_field instanceof EE_Primary_Key_Field_Base) {
86
+				$schema['properties'][ $field ]['primary_key'] = true;
87
+				if ($model_field instanceof EE_Primary_Key_Int_Field) {
88
+					$schema['properties'][ $field ]['readonly'] = true;
89
+				}
90
+			}
91 91
 
92
-            // if this is a foreign key field add the foreign key item
93
-            if ($model_field instanceof EE_Foreign_Key_Field_Base) {
94
-                $schema['properties'][ $field ]['foreign_key'] = array(
95
-                    'description' => esc_html__(
96
-                        'This is a foreign key the points to the given models.',
97
-                        'event_espresso'
98
-                    ),
99
-                    'type'        => 'array',
100
-                    'enum'        => $model_field->get_model_class_names_pointed_to(),
101
-                );
102
-            }
103
-        }
104
-        return $schema;
105
-    }
92
+			// if this is a foreign key field add the foreign key item
93
+			if ($model_field instanceof EE_Foreign_Key_Field_Base) {
94
+				$schema['properties'][ $field ]['foreign_key'] = array(
95
+					'description' => esc_html__(
96
+						'This is a foreign key the points to the given models.',
97
+						'event_espresso'
98
+					),
99
+					'type'        => 'array',
100
+					'enum'        => $model_field->get_model_class_names_pointed_to(),
101
+				);
102
+			}
103
+		}
104
+		return $schema;
105
+	}
106 106
 
107 107
 
108
-    /**
109
-     * Get the schema for a given set of model relations
110
-     *
111
-     * @param EE_Model_Relation_Base[] $relations_on_model
112
-     * @param array                    $schema
113
-     * @return array
114
-     */
115
-    public function getModelSchemaForRelations(array $relations_on_model, array $schema)
116
-    {
117
-        foreach ($relations_on_model as $model_name => $relation) {
118
-            if (! $relation instanceof EE_Model_Relation_Base) {
119
-                continue;
120
-            }
121
-            $model_name_for_schema = $relation instanceof EE_Belongs_To_Relation
122
-                ? strtolower($model_name)
123
-                : EEH_Inflector::pluralize_and_lower($model_name);
124
-            $schema['properties'][ $model_name_for_schema ] = $relation->getSchema();
125
-            $schema['properties'][ $model_name_for_schema ]['relation_model'] = $model_name;
108
+	/**
109
+	 * Get the schema for a given set of model relations
110
+	 *
111
+	 * @param EE_Model_Relation_Base[] $relations_on_model
112
+	 * @param array                    $schema
113
+	 * @return array
114
+	 */
115
+	public function getModelSchemaForRelations(array $relations_on_model, array $schema)
116
+	{
117
+		foreach ($relations_on_model as $model_name => $relation) {
118
+			if (! $relation instanceof EE_Model_Relation_Base) {
119
+				continue;
120
+			}
121
+			$model_name_for_schema = $relation instanceof EE_Belongs_To_Relation
122
+				? strtolower($model_name)
123
+				: EEH_Inflector::pluralize_and_lower($model_name);
124
+			$schema['properties'][ $model_name_for_schema ] = $relation->getSchema();
125
+			$schema['properties'][ $model_name_for_schema ]['relation_model'] = $model_name;
126 126
 
127
-            // links schema
128
-            $links_key = 'https://api.eventespresso.com/' . strtolower($model_name);
129
-            $schema['properties']['_links']['properties'][ $links_key ] = array(
130
-                'description' => esc_html__(
131
-                    'Array of objects describing the link(s) for this relation resource.',
132
-                    'event_espresso'
133
-                ),
134
-                'type' => 'array',
135
-                'readonly' => true,
136
-                'items' => array(
137
-                    'type' => 'object',
138
-                    'properties' => array(
139
-                        'href' => array(
140
-                            'type' => 'string',
141
-                            'description' => sprintf(
142
-                                // translators: placeholder is the model name for the relation.
143
-                                esc_html__(
144
-                                    'The link to the resource for the %s relation(s) to this entity',
145
-                                    'event_espresso'
146
-                                ),
147
-                                $model_name
148
-                            ),
149
-                        ),
150
-                        'single' => array(
151
-                            'type' => 'boolean',
152
-                            'description' => sprintf(
153
-                                // translators: placeholder is the model name for the relation.
154
-                                esc_html__(
155
-                                    'Whether or not there is only a single %s relation to this entity',
156
-                                    'event_espresso'
157
-                                ),
158
-                                $model_name
159
-                            ),
160
-                        ),
161
-                    ),
162
-                    'additionalProperties' => false
163
-                ),
164
-            );
165
-        }
166
-        return $schema;
167
-    }
127
+			// links schema
128
+			$links_key = 'https://api.eventespresso.com/' . strtolower($model_name);
129
+			$schema['properties']['_links']['properties'][ $links_key ] = array(
130
+				'description' => esc_html__(
131
+					'Array of objects describing the link(s) for this relation resource.',
132
+					'event_espresso'
133
+				),
134
+				'type' => 'array',
135
+				'readonly' => true,
136
+				'items' => array(
137
+					'type' => 'object',
138
+					'properties' => array(
139
+						'href' => array(
140
+							'type' => 'string',
141
+							'description' => sprintf(
142
+								// translators: placeholder is the model name for the relation.
143
+								esc_html__(
144
+									'The link to the resource for the %s relation(s) to this entity',
145
+									'event_espresso'
146
+								),
147
+								$model_name
148
+							),
149
+						),
150
+						'single' => array(
151
+							'type' => 'boolean',
152
+							'description' => sprintf(
153
+								// translators: placeholder is the model name for the relation.
154
+								esc_html__(
155
+									'Whether or not there is only a single %s relation to this entity',
156
+									'event_espresso'
157
+								),
158
+								$model_name
159
+							),
160
+						),
161
+					),
162
+					'additionalProperties' => false
163
+				),
164
+			);
165
+		}
166
+		return $schema;
167
+	}
168 168
 
169 169
 
170
-    /**
171
-     * Outputs the schema header for a model.
172
-     *
173
-     * @return array
174
-     */
175
-    public function getInitialSchemaStructure()
176
-    {
177
-        return array(
178
-            '$schema'    => 'http://json-schema.org/draft-04/schema#',
179
-            'title'      => $this->model->get_this_model_name(),
180
-            'type'       => 'object',
181
-            'properties' => array(
182
-                'link' => array(
183
-                    'description' => esc_html__(
184
-                        'Link to event on WordPress site hosting events.',
185
-                        'event_espresso'
186
-                    ),
187
-                    'type' => 'string',
188
-                    'readonly' => true,
189
-                ),
190
-                '_links' => array(
191
-                    'description' => esc_html__(
192
-                        'Various links for resources related to the entity.',
193
-                        'event_espresso'
194
-                    ),
195
-                    'type' => 'object',
196
-                    'readonly' => true,
197
-                    'properties' => array(
198
-                        'self' => array(
199
-                            'description' => esc_html__(
200
-                                'Link to this entities resource.',
201
-                                'event_espresso'
202
-                            ),
203
-                            'type' => 'array',
204
-                            'items' => array(
205
-                                'type' => 'object',
206
-                                'properties' => array(
207
-                                    'href' => array(
208
-                                        'type' => 'string',
209
-                                    ),
210
-                                ),
211
-                                'additionalProperties' => false
212
-                            ),
213
-                            'readonly' => true
214
-                        ),
215
-                        'collection' => array(
216
-                            'description' => esc_html__(
217
-                                'Link to this entities collection resource.',
218
-                                'event_espresso'
219
-                            ),
220
-                            'type' => 'array',
221
-                            'items' => array(
222
-                                'type' => 'object',
223
-                                'properties' => array(
224
-                                    'href' => array(
225
-                                        'type' => 'string'
226
-                                    ),
227
-                                ),
228
-                                'additionalProperties' => false
229
-                            ),
230
-                            'readonly' => true
231
-                        ),
232
-                    ),
233
-                    'additionalProperties' => false,
234
-                ),
235
-                '_calculated_fields' => array_merge(
236
-                    $this->fields_calculator->getJsonSchemaForModel($this->model),
237
-                    array(
238
-                        '_protected' => $this->getProtectedFieldsSchema()
239
-                    )
240
-                ),
241
-                '_protected' => $this->getProtectedFieldsSchema()
242
-            ),
243
-            'additionalProperties' => false,
244
-        );
245
-    }
170
+	/**
171
+	 * Outputs the schema header for a model.
172
+	 *
173
+	 * @return array
174
+	 */
175
+	public function getInitialSchemaStructure()
176
+	{
177
+		return array(
178
+			'$schema'    => 'http://json-schema.org/draft-04/schema#',
179
+			'title'      => $this->model->get_this_model_name(),
180
+			'type'       => 'object',
181
+			'properties' => array(
182
+				'link' => array(
183
+					'description' => esc_html__(
184
+						'Link to event on WordPress site hosting events.',
185
+						'event_espresso'
186
+					),
187
+					'type' => 'string',
188
+					'readonly' => true,
189
+				),
190
+				'_links' => array(
191
+					'description' => esc_html__(
192
+						'Various links for resources related to the entity.',
193
+						'event_espresso'
194
+					),
195
+					'type' => 'object',
196
+					'readonly' => true,
197
+					'properties' => array(
198
+						'self' => array(
199
+							'description' => esc_html__(
200
+								'Link to this entities resource.',
201
+								'event_espresso'
202
+							),
203
+							'type' => 'array',
204
+							'items' => array(
205
+								'type' => 'object',
206
+								'properties' => array(
207
+									'href' => array(
208
+										'type' => 'string',
209
+									),
210
+								),
211
+								'additionalProperties' => false
212
+							),
213
+							'readonly' => true
214
+						),
215
+						'collection' => array(
216
+							'description' => esc_html__(
217
+								'Link to this entities collection resource.',
218
+								'event_espresso'
219
+							),
220
+							'type' => 'array',
221
+							'items' => array(
222
+								'type' => 'object',
223
+								'properties' => array(
224
+									'href' => array(
225
+										'type' => 'string'
226
+									),
227
+								),
228
+								'additionalProperties' => false
229
+							),
230
+							'readonly' => true
231
+						),
232
+					),
233
+					'additionalProperties' => false,
234
+				),
235
+				'_calculated_fields' => array_merge(
236
+					$this->fields_calculator->getJsonSchemaForModel($this->model),
237
+					array(
238
+						'_protected' => $this->getProtectedFieldsSchema()
239
+					)
240
+				),
241
+				'_protected' => $this->getProtectedFieldsSchema()
242
+			),
243
+			'additionalProperties' => false,
244
+		);
245
+	}
246 246
 
247
-    /**
248
-     * Returns an array of JSON schema to describe the _protected property on responses
249
-     * @since 4.9.74.p
250
-     * @return array
251
-     */
252
-    protected function getProtectedFieldsSchema()
253
-    {
254
-        return array(
255
-            'description' => esc_html__('Array of property names whose values were replaced with their default (because they are related to a password-protected entity.)', 'event_espresso'),
256
-            'type' => 'array',
257
-            'items' => array(
258
-                'description' => esc_html__('Each name corresponds to a property that is protected by password for this entity and has its default value returned in the response.', 'event_espresso'),
259
-                'type' => 'string',
260
-                'readonly' => true,
261
-            ),
262
-            'readonly' => true
263
-        );
264
-    }
247
+	/**
248
+	 * Returns an array of JSON schema to describe the _protected property on responses
249
+	 * @since 4.9.74.p
250
+	 * @return array
251
+	 */
252
+	protected function getProtectedFieldsSchema()
253
+	{
254
+		return array(
255
+			'description' => esc_html__('Array of property names whose values were replaced with their default (because they are related to a password-protected entity.)', 'event_espresso'),
256
+			'type' => 'array',
257
+			'items' => array(
258
+				'description' => esc_html__('Each name corresponds to a property that is protected by password for this entity and has its default value returned in the response.', 'event_espresso'),
259
+				'type' => 'string',
260
+				'readonly' => true,
261
+			),
262
+			'readonly' => true
263
+		);
264
+	}
265 265
 
266 266
 
267
-    /**
268
-     * Allows one to just use the object as a string to get the json.
269
-     * eg.
270
-     * $json_schema = new JsonModelSchema(EEM_Event::instance(), new CalculatedModelFields);
271
-     * echo $json_schema; //outputs the schema as a json formatted string.
272
-     *
273
-     * @return bool|false|mixed|string
274
-     */
275
-    public function __toString()
276
-    {
277
-        return wp_json_encode($this->getModelSchema());
278
-    }
267
+	/**
268
+	 * Allows one to just use the object as a string to get the json.
269
+	 * eg.
270
+	 * $json_schema = new JsonModelSchema(EEM_Event::instance(), new CalculatedModelFields);
271
+	 * echo $json_schema; //outputs the schema as a json formatted string.
272
+	 *
273
+	 * @return bool|false|mixed|string
274
+	 */
275
+	public function __toString()
276
+	{
277
+		return wp_json_encode($this->getModelSchema());
278
+	}
279 279
 }
Please login to merge, or discard this patch.