Completed
Branch FET-9593-collection-loader-man... (8bd595)
by
unknown
328:26 queued 314:10
created
core/services/locators/FqcnLocator.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	 * given a valid namespace, will find all files that match the provided mask
78 78
 	 *
79 79
 	 * @access public
80
-	 * @param string|array $namespaces
80
+	 * @param string $namespaces
81 81
 	 * @return FilesystemIterator
82 82
 	 * @throws \EventEspresso\Core\Exceptions\InvalidClassException
83 83
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 use EventEspresso\Core\Psr4Autoloader;
7 7
 use FilesystemIterator;
8 8
 
9
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
10
-	exit( 'No direct script access allowed' );
9
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
10
+	exit('No direct script access allowed');
11 11
 }
12 12
 
13 13
 
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 	 * @param string $namespace_base_dir
41 41
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
42 42
 	 */
43
-	protected function setNamespace( $namespace, $namespace_base_dir ) {
44
-		if ( ! is_string( $namespace ) ) {
45
-			throw new InvalidDataTypeException( '$namespace', $namespace, 'string' );
43
+	protected function setNamespace($namespace, $namespace_base_dir) {
44
+		if ( ! is_string($namespace)) {
45
+			throw new InvalidDataTypeException('$namespace', $namespace, 'string');
46 46
 		}
47
-		if ( ! is_string( $namespace_base_dir ) ) {
48
-			throw new InvalidDataTypeException( '$namespace_base_dir', $namespace_base_dir, 'string' );
47
+		if ( ! is_string($namespace_base_dir)) {
48
+			throw new InvalidDataTypeException('$namespace_base_dir', $namespace_base_dir, 'string');
49 49
 		}
50
-		$this->namespaces[ $namespace ] = $namespace_base_dir;
50
+		$this->namespaces[$namespace] = $namespace_base_dir;
51 51
 	}
52 52
 
53 53
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 * @return int
68 68
 	 */
69 69
 	public function count() {
70
-		return count( $this->FQCNs );
70
+		return count($this->FQCNs);
71 71
 	}
72 72
 
73 73
 
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
 	 * @throws \EventEspresso\Core\Exceptions\InvalidClassException
83 83
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
84 84
 	 */
85
-	public function locate( $namespaces ) {
86
-		if ( ! ( is_string( $namespaces ) || is_array( $namespaces ) ) ) {
87
-			throw new InvalidDataTypeException( '$namespaces', $namespaces, 'string or array' );
85
+	public function locate($namespaces) {
86
+		if ( ! (is_string($namespaces) || is_array($namespaces))) {
87
+			throw new InvalidDataTypeException('$namespaces', $namespaces, 'string or array');
88 88
 		}
89
-		foreach ( (array) $namespaces as $namespace ) {
90
-			foreach ( $this->FindFQCNsByNamespace( $namespace ) as $key => $file ) {
91
-				$this->FQCNs[ $key ] = $file;
89
+		foreach ((array) $namespaces as $namespace) {
90
+			foreach ($this->FindFQCNsByNamespace($namespace) as $key => $file) {
91
+				$this->FQCNs[$key] = $file;
92 92
 			}
93 93
 		}
94 94
 		return $this->FQCNs;
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
 	 * @throws \EventEspresso\Core\Exceptions\InvalidClassException
108 108
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
109 109
 	 */
110
-	protected function FindFQCNsByNamespace( $partial_namespace ) {
110
+	protected function FindFQCNsByNamespace($partial_namespace) {
111 111
 		$iterator = new FilesystemIterator(
112
-			$this->getDirectoryFromPartialNamespace( $partial_namespace )
112
+			$this->getDirectoryFromPartialNamespace($partial_namespace)
113 113
 		);
114
-		foreach ( $this->flags as $flag ) {
115
-			$iterator->setFlags( $flag );
114
+		foreach ($this->flags as $flag) {
115
+			$iterator->setFlags($flag);
116 116
 		}
117
-		if ( iterator_count( $iterator ) === 0 ) {
117
+		if (iterator_count($iterator) === 0) {
118 118
 			return array();
119 119
 		}
120
-		foreach ( $iterator as $file ) {
121
-			$file = \EEH_File::standardise_directory_separators( $file );
122
-			foreach ( $this->namespaces as $namespace => $base_dir ) {
120
+		foreach ($iterator as $file) {
121
+			$file = \EEH_File::standardise_directory_separators($file);
122
+			foreach ($this->namespaces as $namespace => $base_dir) {
123 123
 				$namespace .= Psr4Autoloader::NS;
124
-				if ( strpos( $file, $base_dir ) === 0 ) {
125
-					$this->FQCNs[] = Psr4Autoloader::NS . str_replace(
126
-							array( $base_dir, DS, '.php' ),
127
-							array( $namespace, Psr4Autoloader::NS, '' ),
124
+				if (strpos($file, $base_dir) === 0) {
125
+					$this->FQCNs[] = Psr4Autoloader::NS.str_replace(
126
+							array($base_dir, DS, '.php'),
127
+							array($namespace, Psr4Autoloader::NS, ''),
128 128
 							$file
129 129
 						);
130 130
 				}
@@ -144,25 +144,25 @@  discard block
 block discarded – undo
144 144
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
145 145
 	 * @throws \EventEspresso\Core\Exceptions\InvalidClassException
146 146
 	 */
147
-	protected function getDirectoryFromPartialNamespace( $partial_namespace ) {
148
-		if ( empty( $partial_namespace ) ) {
149
-			throw new InvalidClassException( $partial_namespace );
147
+	protected function getDirectoryFromPartialNamespace($partial_namespace) {
148
+		if (empty($partial_namespace)) {
149
+			throw new InvalidClassException($partial_namespace);
150 150
 		}
151 151
 		// load our PSR-4 Autoloader so we can get the list of registered namespaces from it
152 152
 		$psr4_loader = \EE_Psr4AutoloaderInit::psr4_loader();
153 153
 		// breakup the incoming namespace into segments then loop thru them
154
-		$namespace_segments = explode( Psr4Autoloader::NS, trim( $partial_namespace, Psr4Autoloader::NS ) );
154
+		$namespace_segments = explode(Psr4Autoloader::NS, trim($partial_namespace, Psr4Autoloader::NS));
155 155
 		// we're only interested in the first element, so pull that from the array
156
-		$namespace = array_shift( $namespace_segments );
156
+		$namespace = array_shift($namespace_segments);
157 157
 		// check if there's a base directory registered for that namespace
158
-		$prefix = $psr4_loader->prefixes( $namespace . Psr4Autoloader::NS );
158
+		$prefix = $psr4_loader->prefixes($namespace.Psr4Autoloader::NS);
159 159
 		// nope? then the incoming namespace is invalid
160
-		if ( empty( $prefix ) || empty( $prefix[0] ) ) {
161
-			throw new InvalidClassException( $partial_namespace );
160
+		if (empty($prefix) || empty($prefix[0])) {
161
+			throw new InvalidClassException($partial_namespace);
162 162
 		}
163
-		$this->setNamespace( $namespace, $prefix[0] );
163
+		$this->setNamespace($namespace, $prefix[0]);
164 164
 		// but if it's good, add that base directory to the rest of the path, and return it
165
-		return $prefix[0] . implode( DS, $namespace_segments ) . DS;
165
+		return $prefix[0].implode(DS, $namespace_segments).DS;
166 166
 	}
167 167
 
168 168
 
Please login to merge, or discard this patch.
core/services/locators/Locator.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 use EventEspresso\Core\Exceptions\InvalidDataTypeException;
6 6
 use FilesystemIterator;
7 7
 
8
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
9
-	exit( 'No direct script access allowed' );
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10 10
 }
11 11
 
12 12
 
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
 	 * @param array $flags controls how files are found and/or file data is returned
36 36
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
37 37
 	 */
38
-	public function __construct( $flags = array() ) {
39
-		if ( empty( $flags ) ) {
38
+	public function __construct($flags = array()) {
39
+		if (empty($flags)) {
40 40
 			$flags = array(
41 41
 				FilesystemIterator::SKIP_DOTS,
42 42
 				FilesystemIterator::UNIX_PATHS,
43 43
 				FilesystemIterator::CURRENT_AS_PATHNAME
44 44
 			);
45 45
 		}
46
-		$this->setFlags( $flags );
46
+		$this->setFlags($flags);
47 47
 	}
48 48
 
49 49
 
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 * @param array $flags
55 55
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
56 56
 	 */
57
-	public function setFlags( $flags ) {
58
-		if ( ! is_array( $flags ) ) {
59
-			throw new InvalidDataTypeException( '$flags', $flags, 'array' );
57
+	public function setFlags($flags) {
58
+		if ( ! is_array($flags)) {
59
+			throw new InvalidDataTypeException('$flags', $flags, 'array');
60 60
 		}
61 61
 		$this->flags = $flags;
62 62
 	}
Please login to merge, or discard this patch.
core/services/locators/FileLocator.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 use FilesystemIterator;
6 6
 use GlobIterator;
7 7
 
8
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
9
-	exit( 'No direct script access allowed' );
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10 10
 }
11 11
 
12 12
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 * @param string $file_mask
39 39
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
40 40
 	 */
41
-	public function setFileMask( $file_mask ) {
42
-		if ( ! is_string( $file_mask ) ) {
43
-			throw new InvalidDataTypeException( '$file_mask', $file_mask, 'string' );
41
+	public function setFileMask($file_mask) {
42
+		if ( ! is_string($file_mask)) {
43
+			throw new InvalidDataTypeException('$file_mask', $file_mask, 'string');
44 44
 		}
45 45
 		$this->file_mask = $file_mask;
46 46
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @return int
64 64
 	 */
65 65
 	public function count() {
66
-		return count( $this->filepaths );
66
+		return count($this->filepaths);
67 67
 	}
68 68
 
69 69
 
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 	 * @return \FilesystemIterator
78 78
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
79 79
 	 */
80
-	public function locate( $directory_paths ) {
81
-		if ( ! ( is_string( $directory_paths ) || is_array( $directory_paths ) ) ) {
82
-			throw new InvalidDataTypeException( '$directory_paths', $directory_paths, 'string or array' );
80
+	public function locate($directory_paths) {
81
+		if ( ! (is_string($directory_paths) || is_array($directory_paths))) {
82
+			throw new InvalidDataTypeException('$directory_paths', $directory_paths, 'string or array');
83 83
 		}
84
-		foreach ( (array) $directory_paths as $directory_path ) {
85
-			foreach ( $this->findFilesByPath( $directory_path ) as $key => $file ) {
86
-				$this->filepaths[ $key ] = \EEH_File::standardise_directory_separators( $file );
84
+		foreach ((array) $directory_paths as $directory_path) {
85
+			foreach ($this->findFilesByPath($directory_path) as $key => $file) {
86
+				$this->filepaths[$key] = \EEH_File::standardise_directory_separators($file);
87 87
 			}
88 88
 		}
89 89
 		return $this->filepaths;
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 	 * @param string $directory_path
99 99
 	 * @return \FilesystemIterator
100 100
 	 */
101
-	protected function findFilesByPath( $directory_path = '' ) {
102
-		$iterator = new GlobIterator (
103
-			\EEH_File::end_with_directory_separator( $directory_path ) . $this->file_mask
101
+	protected function findFilesByPath($directory_path = '') {
102
+		$iterator = new GlobIterator(
103
+			\EEH_File::end_with_directory_separator($directory_path).$this->file_mask
104 104
 		);
105
-		foreach ( $this->flags as $flag ) {
106
-			$iterator->setFlags( $flag );
105
+		foreach ($this->flags as $flag) {
106
+			$iterator->setFlags($flag);
107 107
 		}
108 108
 		return $iterator;
109 109
 	}
Please login to merge, or discard this patch.
core/services/locators/LocatorInterface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\locators;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @param array|string $location
23 23
 	 * @return \FilesystemIterator
24 24
 	 */
25
-	public function locate( $location );
25
+	public function locate($location);
26 26
 
27 27
 }
28 28
 // End of file LocatorInterface.php
Please login to merge, or discard this patch.
core/services/collections/CollectionLoader.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@
 block discarded – undo
165 165
 	 *
166 166
 	 * @access protected
167 167
 	 * @param  $entity
168
-	 * @param  mixed $identifier
168
+	 * @param  string $identifier
169 169
 	 * @return string
170 170
 	 */
171 171
 	protected function addEntityToCollection( $entity, $identifier ) {
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\services\locators\LocatorInterface;
8 8
 use EventEspresso\core\services\locators\FileLocator;
9 9
 
10
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
11
-	exit( 'No direct script access allowed' );
10
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11
+	exit('No direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 		LocatorInterface $file_locator = null
80 80
 	) {
81 81
 		$this->collection_details = $collection_details;
82
-		if ( ! $collection instanceof CollectionInterface ) {
83
-			$collection = new Collection( $this->collection_details->getCollectionInterface() );
82
+		if ( ! $collection instanceof CollectionInterface) {
83
+			$collection = new Collection($this->collection_details->getCollectionInterface());
84 84
 		}
85 85
 		$this->collection = $collection;
86 86
 		$this->file_locator = $file_locator;
@@ -107,12 +107,12 @@  discard block
 block discarded – undo
107 107
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
108 108
 	 */
109 109
 	protected function loadAllFromFilepaths() {
110
-		if ( ! $this->file_locator instanceof FileLocator ) {
110
+		if ( ! $this->file_locator instanceof FileLocator) {
111 111
 			$this->file_locator = new FileLocator();
112 112
 		}
113
-		$this->file_locator->setFileMask( $this->collection_details->getFileMask() );
113
+		$this->file_locator->setFileMask($this->collection_details->getFileMask());
114 114
 		// find all of the files that match the file mask in the specified folder
115
-		$this->file_locator->locate( $this->collection_details->getCollectionPaths() );
115
+		$this->file_locator->locate($this->collection_details->getCollectionPaths());
116 116
 		// filter the results
117 117
 		$filepaths = (array) apply_filters(
118 118
 			"FHEE__CollectionLoader__loadAllFromFilepath__filepaths",
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 			$this->collection_details->collectionName(),
121 121
 			$this->collection_details
122 122
 		);
123
-		if ( empty( $filepaths ) ) {
123
+		if (empty($filepaths)) {
124 124
 			return;
125 125
 		}
126
-		foreach ( $filepaths as $filepath ) {
127
-			$this->loadClassFromFilepath( $filepath );
126
+		foreach ($filepaths as $filepath) {
127
+			$this->loadClassFromFilepath($filepath);
128 128
 		}
129 129
 	}
130 130
 
@@ -140,22 +140,22 @@  discard block
 block discarded – undo
140 140
 	 * @throws \EventEspresso\Core\Exceptions\InvalidFilePathException
141 141
 	 * @throws \EventEspresso\Core\Exceptions\InvalidClassException
142 142
 	 */
143
-	protected function loadClassFromFilepath( $filepath ) {
144
-		if ( ! is_string( $filepath ) ) {
145
-			throw new InvalidDataTypeException( '$filepath', $filepath, 'string' );
143
+	protected function loadClassFromFilepath($filepath) {
144
+		if ( ! is_string($filepath)) {
145
+			throw new InvalidDataTypeException('$filepath', $filepath, 'string');
146 146
 		}
147
-		if ( ! is_readable( $filepath ) ) {
148
-			throw new InvalidFilePathException( $filepath );
147
+		if ( ! is_readable($filepath)) {
148
+			throw new InvalidFilePathException($filepath);
149 149
 		}
150
-		require_once( $filepath );
150
+		require_once($filepath);
151 151
 		// extract filename from path
152
-		$file_name = basename( $filepath );
152
+		$file_name = basename($filepath);
153 153
 		// now remove any file extensions
154
-		$class_name = \EEH_File::get_classname_from_filepath_with_standard_filename( $file_name );
155
-		if ( ! class_exists( $class_name ) ) {
156
-			throw new InvalidClassException( $class_name );
154
+		$class_name = \EEH_File::get_classname_from_filepath_with_standard_filename($file_name);
155
+		if ( ! class_exists($class_name)) {
156
+			throw new InvalidClassException($class_name);
157 157
 		}
158
-		return $this->addEntityToCollection( new $class_name(), $file_name );
158
+		return $this->addEntityToCollection(new $class_name(), $file_name);
159 159
 	}
160 160
 
161 161
 
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
 	 * @param  mixed $identifier
169 169
 	 * @return string
170 170
 	 */
171
-	protected function addEntityToCollection( $entity, $identifier ) {
171
+	protected function addEntityToCollection($entity, $identifier) {
172 172
 		do_action(
173 173
 			"FHEE__CollectionLoader__addEntityToCollection__entity",
174 174
 			$entity,
175 175
 			$this->collection_details->collectionName(),
176 176
 			$this->collection_details
177 177
 		);
178
-		if ( $this->collection_details->identifierType() === CollectionDetails::ID_OBJECT_HASH ) {
179
-			$identifier = spl_object_hash( $entity );
178
+		if ($this->collection_details->identifierType() === CollectionDetails::ID_OBJECT_HASH) {
179
+			$identifier = spl_object_hash($entity);
180 180
 		}
181 181
 		$identifier = apply_filters(
182 182
 			"FHEE__CollectionLoader__addEntityToCollection__identifier",
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			$this->collection_details->collectionName(),
185 185
 			$this->collection_details
186 186
 		);
187
-		if ( $this->collection->has( $identifier ) ) {
187
+		if ($this->collection->has($identifier)) {
188 188
 			do_action(
189 189
 				"FHEE__CollectionLoader__addEntityToCollection__entity_already_added",
190 190
 				$this,
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 			);
194 194
 			return CollectionLoader::ENTITY_EXISTS;
195 195
 		}
196
-		if( $this->collection->add( $entity, $identifier ) ) {
196
+		if ($this->collection->add($entity, $identifier)) {
197 197
 			do_action(
198 198
 				"FHEE__CollectionLoader__addEntityToCollection__entity_added",
199 199
 				$this,
@@ -229,8 +229,8 @@  discard block
 block discarded – undo
229 229
 			$this->collection_details->collectionName(),
230 230
 			$this->collection_details
231 231
 		);
232
-		foreach ( $FQCNs as $FQCN ) {
233
-			$this->loadClassFromFQCN( $FQCN );
232
+		foreach ($FQCNs as $FQCN) {
233
+			$this->loadClassFromFQCN($FQCN);
234 234
 		}
235 235
 	}
236 236
 
@@ -245,14 +245,14 @@  discard block
 block discarded – undo
245 245
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
246 246
 	 * @throws \EventEspresso\Core\Exceptions\InvalidClassException
247 247
 	 */
248
-	protected function loadClassFromFQCN( $FQCN ) {
249
-		if ( ! is_string( $FQCN ) ) {
250
-			throw new InvalidDataTypeException( '$FQCN', $FQCN, 'string' );
248
+	protected function loadClassFromFQCN($FQCN) {
249
+		if ( ! is_string($FQCN)) {
250
+			throw new InvalidDataTypeException('$FQCN', $FQCN, 'string');
251 251
 		}
252
-		if ( ! class_exists( $FQCN ) ) {
253
-			throw new InvalidClassException( $FQCN );
252
+		if ( ! class_exists($FQCN)) {
253
+			throw new InvalidClassException($FQCN);
254 254
 		}
255
-		return $this->addEntityToCollection( new $FQCN(), $FQCN );
255
+		return $this->addEntityToCollection(new $FQCN(), $FQCN);
256 256
 	}
257 257
 
258 258
 
Please login to merge, or discard this patch.
core/services/collections/CollectionDetailsInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * Class EE_Line_Item_Filter_Collection
Please login to merge, or discard this patch.
core/services/collections/CollectionInterface.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\collection_loaders;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	 * @param  mixed $identifier
26 26
 	 * @return bool
27 27
 	 */
28
-	public function add( $object, $identifier = null );
28
+	public function add($object, $identifier = null);
29 29
 
30 30
 	/**
31 31
 	 * setIdentifier
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param  mixed $identifier
38 38
 	 * @return bool
39 39
 	 */
40
-	public function setIdentifier( $object, $identifier = null );
40
+	public function setIdentifier($object, $identifier = null);
41 41
 
42 42
 	/**
43 43
 	 * get
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param mixed $identifier
49 49
 	 * @return mixed
50 50
 	 */
51
-	public function get( $identifier );
51
+	public function get($identifier);
52 52
 
53 53
 	/**
54 54
 	 * has
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @param  mixed $identifier
61 61
 	 * @return bool
62 62
 	 */
63
-	public function has( $identifier );
63
+	public function has($identifier);
64 64
 
65 65
 	/**
66 66
 	 * hasObject
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @param $object
71 71
 	 * @return bool
72 72
 	 */
73
-	public function hasObject( $object );
73
+	public function hasObject($object);
74 74
 
75 75
 	/**
76 76
 	 * remove
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param $object
81 81
 	 * @return bool
82 82
 	 */
83
-	public function remove( $object );
83
+	public function remove($object);
84 84
 
85 85
 	/**
86 86
 	 * setCurrent
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @param mixed $identifier
91 91
 	 * @return void
92 92
 	 */
93
-	public function setCurrent( $identifier ) ;
93
+	public function setCurrent($identifier);
94 94
 
95 95
 	/**
96 96
 	 * setCurrentUsingObject
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @param $object
101 101
 	 * @return void
102 102
 	 */
103
-	public function setCurrentUsingObject( $object );
103
+	public function setCurrentUsingObject($object);
104 104
 
105 105
 }
106 106
 // End of file CollectionInterface.php
Please login to merge, or discard this patch.
core/services/collections/Collection.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -799,7 +799,6 @@
 block discarded – undo
799 799
 
800 800
 
801 801
 	/**
802
-
803 802
 	 *
804 803
 	 * 	 If the the first date starts at midnight on one day, and the next date ends at midnight on the
805 804
 	 * 	 very next day then this method will return true.
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\Core\Exceptions\InvalidEntityException;
5 5
 use EventEspresso\Core\Exceptions\InvalidInterfaceException;
6 6
 
7
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
8
-	exit( 'No direct script access allowed' );
7
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
8
+	exit('No direct script access allowed');
9 9
 }
10 10
 /**
11 11
  * Class Collection
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	  * @param string $collection_interface
35 35
 	  * @throws \EventEspresso\Core\Exceptions\InvalidInterfaceException
36 36
 	  */
37
-	 public function __construct( $collection_interface ) {
38
-		 $this->setCollectionInterface( $collection_interface );
37
+	 public function __construct($collection_interface) {
38
+		 $this->setCollectionInterface($collection_interface);
39 39
 	 }
40 40
 
41 41
 
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	  * @param  string $collection_interface
48 48
 	  * @throws \EventEspresso\Core\Exceptions\InvalidInterfaceException
49 49
 	  */
50
-	 protected function setCollectionInterface( $collection_interface ) {
51
-		 if ( ! ( interface_exists( $collection_interface ) || class_exists( $collection_interface ) ) ) {
52
-			 throw new InvalidInterfaceException( $collection_interface );
50
+	 protected function setCollectionInterface($collection_interface) {
51
+		 if ( ! (interface_exists($collection_interface) || class_exists($collection_interface))) {
52
+			 throw new InvalidInterfaceException($collection_interface);
53 53
 		 }
54 54
 		 $this->collection_interface = $collection_interface;
55 55
 	 }
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 	  * @return bool
69 69
 	  * @throws \EventEspresso\Core\Exceptions\InvalidEntityException
70 70
 	  */
71
-	 public function add( $object, $identifier = null ) {
72
-		 if ( ! $object instanceof $this->collection_interface ) {
73
-			 throw new InvalidEntityException( get_class( $object ), $this->collection_interface );
71
+	 public function add($object, $identifier = null) {
72
+		 if ( ! $object instanceof $this->collection_interface) {
73
+			 throw new InvalidEntityException(get_class($object), $this->collection_interface);
74 74
 		 }
75
-		 $this->attach( $object );
76
-		 $this->setIdentifier( $object, $identifier );
77
-		 return $this->contains( $object );
75
+		 $this->attach($object);
76
+		 $this->setIdentifier($object, $identifier);
77
+		 return $this->contains($object);
78 78
 	 }
79 79
 
80 80
 
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	  * @param  mixed $identifier
91 91
 	  * @return bool
92 92
 	  */
93
-	 public function setIdentifier( $object, $identifier = null ) {
94
-		 $identifier = ! empty( $identifier ) ? $identifier : spl_object_hash( $object );
93
+	 public function setIdentifier($object, $identifier = null) {
94
+		 $identifier = ! empty($identifier) ? $identifier : spl_object_hash($object);
95 95
 		 $this->rewind();
96
-		 while ( $this->valid() ) {
97
-			 if ( $object === $this->current() ) {
98
-				 $this->setInfo( $identifier );
96
+		 while ($this->valid()) {
97
+			 if ($object === $this->current()) {
98
+				 $this->setInfo($identifier);
99 99
 				 $this->rewind();
100 100
 				 return true;
101 101
 			 }
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 	  * @param mixed $identifier
116 116
 	  * @return mixed
117 117
 	  */
118
-	 public function get( $identifier ) {
118
+	 public function get($identifier) {
119 119
 		 $this->rewind();
120
-		 while ( $this->valid() ) {
121
-			 if ( $identifier === $this->getInfo() ) {
120
+		 while ($this->valid()) {
121
+			 if ($identifier === $this->getInfo()) {
122 122
 				 $object = $this->current();
123 123
 				 $this->rewind();
124 124
 				 return $object;
@@ -140,10 +140,10 @@  discard block
 block discarded – undo
140 140
 	  * @param  mixed $identifier
141 141
 	  * @return bool
142 142
 	  */
143
-	 public function has( $identifier ) {
143
+	 public function has($identifier) {
144 144
 		 $this->rewind();
145
-		 while ( $this->valid() ) {
146
-			 if ( $identifier === $this->getInfo() ) {
145
+		 while ($this->valid()) {
146
+			 if ($identifier === $this->getInfo()) {
147 147
 				 $this->rewind();
148 148
 				 return true;
149 149
 			 }
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	  * @param $object
163 163
 	  * @return bool
164 164
 	  */
165
-	 public function hasObject( $object ) {
166
-		 return $this->contains( $object );
165
+	 public function hasObject($object) {
166
+		 return $this->contains($object);
167 167
 	 }
168 168
 
169 169
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 	  * @param $object
177 177
 	  * @return bool
178 178
 	  */
179
-	 public function remove( $object ) {
180
-		 $this->detach( $object );
179
+	 public function remove($object) {
180
+		 $this->detach($object);
181 181
 		 return true;
182 182
 	 }
183 183
 
@@ -191,10 +191,10 @@  discard block
 block discarded – undo
191 191
 	  * @param mixed $identifier
192 192
 	  * @return void
193 193
 	  */
194
-	 public function setCurrent( $identifier ) {
194
+	 public function setCurrent($identifier) {
195 195
 		 $this->rewind();
196
-		 while ( $this->valid() ) {
197
-			 if ( $identifier === $this->getInfo() ) {
196
+		 while ($this->valid()) {
197
+			 if ($identifier === $this->getInfo()) {
198 198
 				 break;
199 199
 			 }
200 200
 			 $this->next();
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 	  * @param $object
212 212
 	  * @return void
213 213
 	  */
214
-	 public function setCurrentUsingObject( $object ) {
214
+	 public function setCurrentUsingObject($object) {
215 215
 		 $this->rewind();
216
-		 while ( $this->valid() ) {
217
-			 if ( $this->current() === $object ) {
216
+		 while ($this->valid()) {
217
+			 if ($this->current() === $object) {
218 218
 				 break;
219 219
 			 }
220 220
 			 $this->next();
Please login to merge, or discard this patch.
core/services/collections/CollectionDetails.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -799,7 +799,6 @@
 block discarded – undo
799 799
 
800 800
 
801 801
 	/**
802
-
803 802
 	 *
804 803
 	 * 	 If the the first date starts at midnight on one day, and the next date ends at midnight on the
805 804
 	 * 	 very next day then this method will return true.
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 use EventEspresso\core\services\locators\FqcnLocator;
9 9
 use EventEspresso\core\services\locators\LocatorInterface;
10 10
 
11
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
12
-	exit( 'No direct script access allowed' );
11
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
12
+	exit('No direct script access allowed');
13 13
 }
14 14
 
15 15
 
@@ -153,12 +153,12 @@  discard block
 block discarded – undo
153 153
 		$identifier_type = CollectionDetails::ID_OBJECT_HASH,
154 154
 		LocatorInterface $file_locator = null
155 155
 	) {
156
-		$this->setCollectionName( $collection_name );
157
-		$this->setCollectionInterface( $collection_interface );
158
-		$this->setCollectionFQCNs( $collection_FQCNs );
159
-		$this->setCollectionPaths( $collection_paths );
160
-		$this->setFileMasks( $file_mask );
161
-		$this->setIdentifierType( $identifier_type );
156
+		$this->setCollectionName($collection_name);
157
+		$this->setCollectionInterface($collection_interface);
158
+		$this->setCollectionFQCNs($collection_FQCNs);
159
+		$this->setCollectionPaths($collection_paths);
160
+		$this->setFileMasks($file_mask);
161
+		$this->setIdentifierType($identifier_type);
162 162
 		$this->file_locator = $file_locator;
163 163
 	}
164 164
 
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 	 * @param string $collection_interface
180 180
 	 * @throws \EventEspresso\Core\Exceptions\InvalidInterfaceException
181 181
 	 */
182
-	protected function setCollectionInterface( $collection_interface ) {
183
-		if ( ! ( interface_exists( $collection_interface ) || class_exists( $collection_interface ) ) ) {
184
-			throw new InvalidInterfaceException( $collection_interface );
182
+	protected function setCollectionInterface($collection_interface) {
183
+		if ( ! (interface_exists($collection_interface) || class_exists($collection_interface))) {
184
+			throw new InvalidInterfaceException($collection_interface);
185 185
 		}
186 186
 		$this->collection_interface = $collection_interface;
187 187
 	}
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 	 * @param string $collection_name
208 208
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
209 209
 	 */
210
-	protected function setCollectionName( $collection_name ) {
211
-		if ( ! is_string( $collection_name ) ) {
212
-			throw new InvalidDataTypeException( '$collection_name', $collection_name, 'string' );
210
+	protected function setCollectionName($collection_name) {
211
+		if ( ! is_string($collection_name)) {
212
+			throw new InvalidDataTypeException('$collection_name', $collection_name, 'string');
213 213
 		}
214 214
 		$this->collection_name = str_replace(
215 215
 			'-',
216 216
 			'_',
217
-			sanitize_title_with_dashes( $collection_name, '', 'save' )
217
+			sanitize_title_with_dashes($collection_name, '', 'save')
218 218
 		);
219 219
 	}
220 220
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @param string $identifier_type
236 236
 	 * @throws \EventEspresso\Core\Exceptions\InvalidIdentifierException
237 237
 	 */
238
-	protected function setIdentifierType( $identifier_type ) {
238
+	protected function setIdentifierType($identifier_type) {
239 239
 		if (
240 240
 			! (
241 241
 				$identifier_type === CollectionDetails::ID_CLASS_NAME
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 	 * @param string $file_mask
271 271
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
272 272
 	 */
273
-	protected function setFileMasks( $file_mask ) {
274
-		$this->file_mask = ! empty( $file_mask ) ? $file_mask : '*.php';
273
+	protected function setFileMasks($file_mask) {
274
+		$this->file_mask = ! empty($file_mask) ? $file_mask : '*.php';
275 275
 		// we know our default is a string, so if it's not a string now,
276 276
 		// then that means the incoming parameter was something else
277
-		if ( ! is_string( $this->file_mask ) ) {
278
-			throw new InvalidDataTypeException( '$file_mask', $this->file_mask, 'string' );
277
+		if ( ! is_string($this->file_mask)) {
278
+			throw new InvalidDataTypeException('$file_mask', $this->file_mask, 'string');
279 279
 		}
280 280
 	}
281 281
 
@@ -297,13 +297,13 @@  discard block
 block discarded – undo
297 297
 	 * @throws \EventEspresso\Core\Exceptions\InvalidClassException
298 298
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
299 299
 	 */
300
-	public function setCollectionFQCNs( $collection_FQCNs ) {
301
-		foreach ( (array) $collection_FQCNs as $collection_FQCN ) {
302
-			if ( ! empty( $collection_FQCN ) ) {
303
-				if ( class_exists( $collection_FQCN ) ) {
300
+	public function setCollectionFQCNs($collection_FQCNs) {
301
+		foreach ((array) $collection_FQCNs as $collection_FQCN) {
302
+			if ( ! empty($collection_FQCN)) {
303
+				if (class_exists($collection_FQCN)) {
304 304
 					$this->collection_FQCNs[] = $collection_FQCN;
305 305
 				} else {
306
-					foreach ( $this->getFQCNsFromPartialNamespace( $collection_FQCN ) as $FQCN ) {
306
+					foreach ($this->getFQCNsFromPartialNamespace($collection_FQCN) as $FQCN) {
307 307
 						$this->collection_FQCNs[] = $FQCN;
308 308
 					}
309 309
 				}
@@ -320,11 +320,11 @@  discard block
 block discarded – undo
320 320
 	 * @throws \EventEspresso\Core\Exceptions\InvalidDataTypeException
321 321
 	 * @throws \EventEspresso\Core\Exceptions\InvalidClassException
322 322
 	 */
323
-	protected function getFQCNsFromPartialNamespace( $partial_FQCN ) {
324
-		if ( ! $this->file_locator instanceof FqcnLocator ) {
323
+	protected function getFQCNsFromPartialNamespace($partial_FQCN) {
324
+		if ( ! $this->file_locator instanceof FqcnLocator) {
325 325
 			$this->file_locator = new FqcnLocator();
326 326
 		}
327
-		$this->file_locator->locate( $partial_FQCN );
327
+		$this->file_locator->locate($partial_FQCN);
328 328
 		return $this->file_locator->getFQCNs();
329 329
 	}
330 330
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 	 * @param string|array $collection_paths
346 346
 	 * @throws \EventEspresso\Core\Exceptions\InvalidFilePathException
347 347
 	 */
348
-	public function setCollectionPaths( $collection_paths ) {
349
-		foreach ( (array) $collection_paths as $collection_path ) {
350
-			if ( ! empty( $collection_path ) ) {
351
-				if ( ! is_readable( $collection_path ) ) {
352
-					throw new InvalidFilePathException( $collection_path );
348
+	public function setCollectionPaths($collection_paths) {
349
+		foreach ((array) $collection_paths as $collection_path) {
350
+			if ( ! empty($collection_path)) {
351
+				if ( ! is_readable($collection_path)) {
352
+					throw new InvalidFilePathException($collection_path);
353 353
 				}
354 354
 				$this->collection_paths[] = $collection_path;
355 355
 			}
Please login to merge, or discard this patch.