Completed
Pull Request — Gutenberg/master (#614)
by
unknown
13:15
created
core/services/dependencies/ClassAlias.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -15,45 +15,45 @@
 block discarded – undo
15 15
 class ClassAlias
16 16
 {
17 17
 
18
-    /**
19
-     * @var string $alias
20
-     */
21
-    private $alias;
22
-
23
-    /**
24
-     * @var string $fqcn
25
-     */
26
-    private $fqcn;
27
-
28
-    /**
29
-     * DependencyAlias constructor.
30
-     *
31
-     * @param string $alias Interface specified by implementing class
32
-     * @param string $fqcn  Concrete class that satisfies interface
33
-     * @throws InvalidAliasException
34
-     */
35
-    public function __construct($alias, $fqcn)
36
-    {
37
-        if (! is_subclass_of($fqcn, $alias)) {
38
-            throw new InvalidAliasException($fqcn, $alias);
39
-        }
40
-        $this->alias = $alias;
41
-        $this->fqcn = $fqcn;
42
-    }
43
-
44
-    /**
45
-     * @return string
46
-     */
47
-    public function alias()
48
-    {
49
-        return $this->alias;
50
-    }
51
-
52
-    /**
53
-     * @return string
54
-     */
55
-    public function fqcn()
56
-    {
57
-        return $this->fqcn;
58
-    }
18
+	/**
19
+	 * @var string $alias
20
+	 */
21
+	private $alias;
22
+
23
+	/**
24
+	 * @var string $fqcn
25
+	 */
26
+	private $fqcn;
27
+
28
+	/**
29
+	 * DependencyAlias constructor.
30
+	 *
31
+	 * @param string $alias Interface specified by implementing class
32
+	 * @param string $fqcn  Concrete class that satisfies interface
33
+	 * @throws InvalidAliasException
34
+	 */
35
+	public function __construct($alias, $fqcn)
36
+	{
37
+		if (! is_subclass_of($fqcn, $alias)) {
38
+			throw new InvalidAliasException($fqcn, $alias);
39
+		}
40
+		$this->alias = $alias;
41
+		$this->fqcn = $fqcn;
42
+	}
43
+
44
+	/**
45
+	 * @return string
46
+	 */
47
+	public function alias()
48
+	{
49
+		return $this->alias;
50
+	}
51
+
52
+	/**
53
+	 * @return string
54
+	 */
55
+	public function fqcn()
56
+	{
57
+		return $this->fqcn;
58
+	}
59 59
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public function __construct($alias, $fqcn)
36 36
     {
37
-        if (! is_subclass_of($fqcn, $alias)) {
37
+        if ( ! is_subclass_of($fqcn, $alias)) {
38 38
             throw new InvalidAliasException($fqcn, $alias);
39 39
         }
40 40
         $this->alias = $alias;
Please login to merge, or discard this patch.
core/services/dependencies/DependencyResolver.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
      */
99 99
     public function addAlias(ClassAlias $alias)
100 100
     {
101
-        $this->aliases[ $alias->fqcn() ] = $alias;
101
+        $this->aliases[$alias->fqcn()] = $alias;
102 102
     }
103 103
 
104 104
     /**
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function resolveAlias($param_fqcn)
109 109
     {
110
-        return isset($this->aliases[ $param_fqcn ])
111
-            ? $this->aliases[ $param_fqcn ]->alias()
110
+        return isset($this->aliases[$param_fqcn])
111
+            ? $this->aliases[$param_fqcn]->alias()
112 112
             : $this->classCache()->getFqnForAlias($param_fqcn);
113 113
     }
114 114
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
                 $this->resolveDependenciesForClass($param_class);
172 172
             }
173 173
             $param_class = $this->resolveAlias($param_class);
174
-            $dependencies[ $param_class ] = EE_Dependency_Map::load_from_cache;
174
+            $dependencies[$param_class] = EE_Dependency_Map::load_from_cache;
175 175
         }
176 176
         $this->dependencyMap()->registerDependencies($fqcn, $dependencies);
177 177
     }
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
-    private $aliases = array();
45
-
46
-    /**
47
-     * @var array $recursions
48
-     */
49
-    private $recursions = 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->fqcn() ] = $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 ]->alias()
111
-            : $this->classCache()->getFqnForAlias($param_fqcn);
112
-    }
113
-
114
-    /**
115
-     * Primarily used to indicate the base namespace 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 base namespace  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 $base_namespace Partial namespace used for detecting other classes
130
-     *                               that should employ this same DependencyResolver
131
-     */
132
-    public function addRecursion($base_namespace)
133
-    {
134
-        $this->recursions[] = $base_namespace;
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 $VID:$
144
-     */
145
-    public function dependencyRecursionExists($param_fqcn)
146
-    {
147
-        foreach ($this->recursions as $recursion) {
148
-            if (strpos($param_fqcn, $recursion) !== 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 $VID:$
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
+	private $aliases = array();
45
+
46
+	/**
47
+	 * @var array $recursions
48
+	 */
49
+	private $recursions = 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->fqcn() ] = $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 ]->alias()
111
+			: $this->classCache()->getFqnForAlias($param_fqcn);
112
+	}
113
+
114
+	/**
115
+	 * Primarily used to indicate the base namespace 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 base namespace  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 $base_namespace Partial namespace used for detecting other classes
130
+	 *                               that should employ this same DependencyResolver
131
+	 */
132
+	public function addRecursion($base_namespace)
133
+	{
134
+		$this->recursions[] = $base_namespace;
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 $VID:$
144
+	 */
145
+	public function dependencyRecursionExists($param_fqcn)
146
+	{
147
+		foreach ($this->recursions as $recursion) {
148
+			if (strpos($param_fqcn, $recursion) !== 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 $VID:$
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/services/factory/FactoryWithDependencyResolver.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -18,41 +18,41 @@
 block discarded – undo
18 18
  */
19 19
 abstract class FactoryWithDependencyResolver implements FactoryInterface
20 20
 {
21
-    /**
22
-     * @var DependencyResolverInterface $dependency_resolver
23
-     */
24
-    private $dependency_resolver;
21
+	/**
22
+	 * @var DependencyResolverInterface $dependency_resolver
23
+	 */
24
+	private $dependency_resolver;
25 25
 
26
-    /**
27
-     * @var LoaderInterface $loader
28
-     */
29
-    private $loader;
26
+	/**
27
+	 * @var LoaderInterface $loader
28
+	 */
29
+	private $loader;
30 30
 
31
-    /**
32
-     * FactoryWithDependencyResolver constructor.
33
-     *
34
-     * @param DependencyResolverInterface $dependency_resolver
35
-     * @param LoaderInterface             $loader
36
-     */
37
-    public function __construct(DependencyResolverInterface $dependency_resolver, LoaderInterface $loader)
38
-    {
39
-        $this->dependency_resolver = $dependency_resolver;
40
-        $this->loader = $loader;
41
-    }
31
+	/**
32
+	 * FactoryWithDependencyResolver constructor.
33
+	 *
34
+	 * @param DependencyResolverInterface $dependency_resolver
35
+	 * @param LoaderInterface             $loader
36
+	 */
37
+	public function __construct(DependencyResolverInterface $dependency_resolver, LoaderInterface $loader)
38
+	{
39
+		$this->dependency_resolver = $dependency_resolver;
40
+		$this->loader = $loader;
41
+	}
42 42
 
43
-    /**
44
-     * @return DependencyResolverInterface
45
-     */
46
-    public function dependencyResolver()
47
-    {
48
-        return $this->dependency_resolver;
49
-    }
43
+	/**
44
+	 * @return DependencyResolverInterface
45
+	 */
46
+	public function dependencyResolver()
47
+	{
48
+		return $this->dependency_resolver;
49
+	}
50 50
 
51
-    /**
52
-     * @return LoaderInterface
53
-     */
54
-    public function loader()
55
-    {
56
-        return $this->loader;
57
-    }
51
+	/**
52
+	 * @return LoaderInterface
53
+	 */
54
+	public function loader()
55
+	{
56
+		return $this->loader;
57
+	}
58 58
 }
Please login to merge, or discard this patch.
core/domain/services/factories/FactoryInterface.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 interface FactoryInterface
12 12
 {
13 13
 
14
-    /**
15
-     * @param mixed $arguments Either a Fully Qualified Class Name
16
-     *                         or array of data required for construction
17
-     * @return mixed
18
-     */
19
-    public static function create($arguments);
14
+	/**
15
+	 * @param mixed $arguments Either a Fully Qualified Class Name
16
+	 *                         or array of data required for construction
17
+	 * @return mixed
18
+	 */
19
+	public static function create($arguments);
20 20
 }
Please login to merge, or discard this patch.
core/domain/entities/route_match/MatchAnyRouteSpecification.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
 class MatchAnyRouteSpecification extends MultiRouteSpecification
15 15
 {
16 16
 
17
-    /**
18
-     * returns true if current request matches specification
19
-     *
20
-     * @since $VID:$
21
-     * @return boolean
22
-     */
23
-    public function isMatchingRoute()
24
-    {
25
-        foreach ($this->specifications as $specification) {
26
-            if ($specification->isMatchingRoute()) {
27
-                return true;
28
-            }
29
-        }
30
-        return false;
31
-    }
17
+	/**
18
+	 * returns true if current request matches specification
19
+	 *
20
+	 * @since $VID:$
21
+	 * @return boolean
22
+	 */
23
+	public function isMatchingRoute()
24
+	{
25
+		foreach ($this->specifications as $specification) {
26
+			if ($specification->isMatchingRoute()) {
27
+				return true;
28
+			}
29
+		}
30
+		return false;
31
+	}
32 32
 }
Please login to merge, or discard this patch.
core/domain/entities/route_match/DoesNotMatchRouteSpecification.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@
 block discarded – undo
14 14
  */
15 15
 class DoesNotMatchRouteSpecification extends RouteMatchSpecificationDecorator
16 16
 {
17
-    /**
18
-     * returns true if current request matches specification
19
-     *
20
-     * @since $VID:$
21
-     * @return boolean
22
-     */
23
-    public function isMatchingRoute()
24
-    {
25
-        return ! $this->specification->isMatchingRoute();
26
-    }
17
+	/**
18
+	 * returns true if current request matches specification
19
+	 *
20
+	 * @since $VID:$
21
+	 * @return boolean
22
+	 */
23
+	public function isMatchingRoute()
24
+	{
25
+		return ! $this->specification->isMatchingRoute();
26
+	}
27 27
 }
Please login to merge, or discard this patch.
core/domain/entities/route_match/RouteMatchSpecificationInterface.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
  */
13 13
 interface RouteMatchSpecificationInterface
14 14
 {
15
-    /**
16
-     * returns true if current request matches specification
17
-     *
18
-     * @since $VID:$
19
-     * @return boolean
20
-     */
21
-    public function isMatchingRoute();
15
+	/**
16
+	 * returns true if current request matches specification
17
+	 *
18
+	 * @since $VID:$
19
+	 * @return boolean
20
+	 */
21
+	public function isMatchingRoute();
22 22
 }
Please login to merge, or discard this patch.
core/domain/entities/route_match/MatchAllRouteSpecifications.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
 class MatchAllRouteSpecifications extends MultiRouteSpecification
15 15
 {
16 16
 
17
-    /**
18
-     * returns true if current request matches specification
19
-     *
20
-     * @since $VID:$
21
-     * @return boolean
22
-     */
23
-    public function isMatchingRoute()
24
-    {
25
-        foreach ($this->specifications as $specification) {
26
-            if (! $specification->isMatchingRoute()) {
27
-                return false;
28
-            }
29
-        }
30
-        return true;
31
-    }
17
+	/**
18
+	 * returns true if current request matches specification
19
+	 *
20
+	 * @since $VID:$
21
+	 * @return boolean
22
+	 */
23
+	public function isMatchingRoute()
24
+	{
25
+		foreach ($this->specifications as $specification) {
26
+			if (! $specification->isMatchingRoute()) {
27
+				return false;
28
+			}
29
+		}
30
+		return true;
31
+	}
32 32
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     public function isMatchingRoute()
24 24
     {
25 25
         foreach ($this->specifications as $specification) {
26
-            if (! $specification->isMatchingRoute()) {
26
+            if ( ! $specification->isMatchingRoute()) {
27 27
                 return false;
28 28
             }
29 29
         }
Please login to merge, or discard this patch.
entities/route_match/specifications/admin/EspressoEventsListTable.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -14,18 +14,18 @@
 block discarded – undo
14 14
  */
15 15
 class EspressoEventsListTable extends RouteMatchSpecification
16 16
 {
17
-    /**
18
-     * returns true if current request matches specification
19
-     *
20
-     * @since $VID:$
21
-     * @return boolean
22
-     */
23
-    public function isMatchingRoute()
24
-    {
25
-        return $this->request->getRequestParam('page') === 'espresso_events'
26
-            && (
27
-                $this->request->getRequestParam('action') === 'default'
28
-                || $this->request->requestParamIsSet('action') === false
29
-            );
30
-    }
17
+	/**
18
+	 * returns true if current request matches specification
19
+	 *
20
+	 * @since $VID:$
21
+	 * @return boolean
22
+	 */
23
+	public function isMatchingRoute()
24
+	{
25
+		return $this->request->getRequestParam('page') === 'espresso_events'
26
+			&& (
27
+				$this->request->getRequestParam('action') === 'default'
28
+				|| $this->request->requestParamIsSet('action') === false
29
+			);
30
+	}
31 31
 }
Please login to merge, or discard this patch.