@@ -5,8 +5,8 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -5,8 +5,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\locators; |
3 | 3 | |
4 | -use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
4 | +use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
5 | 5 | use FilesystemIterator; |
6 | 6 | use GlobIterator; |
7 | 7 |
@@ -1,8 +1,8 @@ discard block |
||
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 |
||
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 |
@@ -165,7 +165,7 @@ |
||
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 ) { |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\collections; |
3 | 3 | |
4 | -use EventEspresso\core\exceptions\InvalidClassException; |
|
5 | -use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
6 | -use EventEspresso\core\exceptions\InvalidEntityException; |
|
7 | -use EventEspresso\core\exceptions\InvalidFilePathException; |
|
4 | +use EventEspresso\core\exceptions\InvalidClassException; |
|
5 | +use EventEspresso\core\exceptions\InvalidDataTypeException; |
|
6 | +use EventEspresso\core\exceptions\InvalidEntityException; |
|
7 | +use EventEspresso\core\exceptions\InvalidFilePathException; |
|
8 | 8 | use EventEspresso\core\services\locators\LocatorInterface; |
9 | 9 | use EventEspresso\core\services\locators\FileLocator; |
10 | 10 |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\locators\LocatorInterface; |
9 | 9 | use EventEspresso\core\services\locators\FileLocator; |
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 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | LocatorInterface $file_locator = null |
82 | 82 | ) { |
83 | 83 | $this->collection_details = $collection_details; |
84 | - if ( ! $collection instanceof CollectionInterface ) { |
|
85 | - $collection = new Collection( $this->collection_details->getCollectionInterface() ); |
|
84 | + if ( ! $collection instanceof CollectionInterface) { |
|
85 | + $collection = new Collection($this->collection_details->getCollectionInterface()); |
|
86 | 86 | } |
87 | 87 | $this->collection = $collection; |
88 | 88 | $this->file_locator = $file_locator; |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
111 | 111 | */ |
112 | 112 | protected function loadAllFromFilepaths() { |
113 | - if ( ! $this->file_locator instanceof FileLocator ) { |
|
113 | + if ( ! $this->file_locator instanceof FileLocator) { |
|
114 | 114 | $this->file_locator = new FileLocator(); |
115 | 115 | } |
116 | - $this->file_locator->setFileMask( $this->collection_details->getFileMask() ); |
|
116 | + $this->file_locator->setFileMask($this->collection_details->getFileMask()); |
|
117 | 117 | // find all of the files that match the file mask in the specified folder |
118 | - $this->file_locator->locate( $this->collection_details->getCollectionPaths() ); |
|
118 | + $this->file_locator->locate($this->collection_details->getCollectionPaths()); |
|
119 | 119 | // filter the results |
120 | 120 | $filepaths = (array) apply_filters( |
121 | 121 | "FHEE__CollectionLoader__loadAllFromFilepath__filepaths", |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | $this->collection_details->collectionName(), |
124 | 124 | $this->collection_details |
125 | 125 | ); |
126 | - if ( empty( $filepaths ) ) { |
|
126 | + if (empty($filepaths)) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | - foreach ( $filepaths as $filepath ) { |
|
130 | - $this->loadClassFromFilepath( $filepath ); |
|
129 | + foreach ($filepaths as $filepath) { |
|
130 | + $this->loadClassFromFilepath($filepath); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -144,22 +144,22 @@ discard block |
||
144 | 144 | * @throws \EventEspresso\core\exceptions\InvalidFilePathException |
145 | 145 | * @throws \EventEspresso\core\exceptions\InvalidClassException |
146 | 146 | */ |
147 | - protected function loadClassFromFilepath( $filepath ) { |
|
148 | - if ( ! is_string( $filepath ) ) { |
|
149 | - throw new InvalidDataTypeException( '$filepath', $filepath, 'string' ); |
|
147 | + protected function loadClassFromFilepath($filepath) { |
|
148 | + if ( ! is_string($filepath)) { |
|
149 | + throw new InvalidDataTypeException('$filepath', $filepath, 'string'); |
|
150 | 150 | } |
151 | - if ( ! is_readable( $filepath ) ) { |
|
152 | - throw new InvalidFilePathException( $filepath ); |
|
151 | + if ( ! is_readable($filepath)) { |
|
152 | + throw new InvalidFilePathException($filepath); |
|
153 | 153 | } |
154 | - require_once( $filepath ); |
|
154 | + require_once($filepath); |
|
155 | 155 | // extract filename from path |
156 | - $file_name = basename( $filepath ); |
|
156 | + $file_name = basename($filepath); |
|
157 | 157 | // now remove any file extensions |
158 | - $class_name = \EEH_File::get_classname_from_filepath_with_standard_filename( $file_name ); |
|
159 | - if ( ! class_exists( $class_name ) ) { |
|
160 | - throw new InvalidClassException( $class_name ); |
|
158 | + $class_name = \EEH_File::get_classname_from_filepath_with_standard_filename($file_name); |
|
159 | + if ( ! class_exists($class_name)) { |
|
160 | + throw new InvalidClassException($class_name); |
|
161 | 161 | } |
162 | - return $this->addEntityToCollection( new $class_name(), $file_name ); |
|
162 | + return $this->addEntityToCollection(new $class_name(), $file_name); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | * @return string |
174 | 174 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
175 | 175 | */ |
176 | - protected function addEntityToCollection( $entity, $identifier ) { |
|
176 | + protected function addEntityToCollection($entity, $identifier) { |
|
177 | 177 | do_action( |
178 | 178 | "FHEE__CollectionLoader__addEntityToCollection__entity", |
179 | 179 | $entity, |
180 | 180 | $this->collection_details->collectionName(), |
181 | 181 | $this->collection_details |
182 | 182 | ); |
183 | - $identifier = $this->setIdentifier( $entity, $identifier ); |
|
184 | - if ( $this->collection->has( $identifier ) ) { |
|
183 | + $identifier = $this->setIdentifier($entity, $identifier); |
|
184 | + if ($this->collection->has($identifier)) { |
|
185 | 185 | do_action( |
186 | 186 | "FHEE__CollectionLoader__addEntityToCollection__entity_already_added", |
187 | 187 | $this, |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | ); |
191 | 191 | return CollectionLoader::ENTITY_EXISTS; |
192 | 192 | } |
193 | - if( $this->collection->add( $entity, $identifier ) ) { |
|
193 | + if ($this->collection->add($entity, $identifier)) { |
|
194 | 194 | do_action( |
195 | 195 | "FHEE__CollectionLoader__addEntityToCollection__entity_added", |
196 | 196 | $this, |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | * @return string |
221 | 221 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
222 | 222 | */ |
223 | - protected function setIdentifier( $entity, $identifier ) { |
|
224 | - if ( $this->collection_details->identifierType() === CollectionDetails::ID_OBJECT_HASH ) { |
|
225 | - $identifier = spl_object_hash( $entity ); |
|
226 | - } elseif ( $this->collection_details->identifierType() === CollectionDetails::ID_CALLBACK_METHOD ) { |
|
223 | + protected function setIdentifier($entity, $identifier) { |
|
224 | + if ($this->collection_details->identifierType() === CollectionDetails::ID_OBJECT_HASH) { |
|
225 | + $identifier = spl_object_hash($entity); |
|
226 | + } elseif ($this->collection_details->identifierType() === CollectionDetails::ID_CALLBACK_METHOD) { |
|
227 | 227 | $identifier_callback = $this->collection_details->identifierCallback(); |
228 | - if ( ! method_exists( $entity, $identifier_callback ) ) { |
|
228 | + if ( ! method_exists($entity, $identifier_callback)) { |
|
229 | 229 | throw new InvalidEntityException( |
230 | 230 | $entity, |
231 | 231 | $this->collection_details->getCollectionInterface(), |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | 'event_espresso' |
236 | 236 | ), |
237 | 237 | $identifier_callback, |
238 | - get_class( $entity ) |
|
238 | + get_class($entity) |
|
239 | 239 | ) |
240 | 240 | ); |
241 | 241 | } |
@@ -267,8 +267,8 @@ discard block |
||
267 | 267 | $this->collection_details->collectionName(), |
268 | 268 | $this->collection_details |
269 | 269 | ); |
270 | - foreach ( $FQCNs as $FQCN ) { |
|
271 | - $this->loadClassFromFQCN( $FQCN ); |
|
270 | + foreach ($FQCNs as $FQCN) { |
|
271 | + $this->loadClassFromFQCN($FQCN); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | |
@@ -284,15 +284,15 @@ discard block |
||
284 | 284 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
285 | 285 | * @throws \EventEspresso\core\exceptions\InvalidClassException |
286 | 286 | */ |
287 | - protected function loadClassFromFQCN( $FQCN ) { |
|
288 | - if ( ! is_string( $FQCN ) ) { |
|
289 | - throw new InvalidDataTypeException( '$FQCN', $FQCN, 'string' ); |
|
287 | + protected function loadClassFromFQCN($FQCN) { |
|
288 | + if ( ! is_string($FQCN)) { |
|
289 | + throw new InvalidDataTypeException('$FQCN', $FQCN, 'string'); |
|
290 | 290 | } |
291 | - if ( ! class_exists( $FQCN ) ) { |
|
292 | - throw new InvalidClassException( $FQCN ); |
|
291 | + if ( ! class_exists($FQCN)) { |
|
292 | + throw new InvalidClassException($FQCN); |
|
293 | 293 | } |
294 | 294 | return $this->addEntityToCollection( |
295 | - \EE_Registry::instance()->create( $FQCN ), |
|
295 | + \EE_Registry::instance()->create($FQCN), |
|
296 | 296 | $FQCN |
297 | 297 | ); |
298 | 298 | } |
@@ -1,6 +1,6 @@ |
||
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 |
@@ -799,7 +799,6 @@ |
||
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. |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\collections; |
3 | 3 | |
4 | -use EventEspresso\core\exceptions\InvalidEntityException; |
|
5 | -use EventEspresso\core\exceptions\InvalidInterfaceException; |
|
4 | +use EventEspresso\core\exceptions\InvalidEntityException; |
|
5 | +use EventEspresso\core\exceptions\InvalidInterfaceException; |
|
6 | 6 | use LimitIterator; |
7 | 7 | |
8 | 8 | if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | use EventEspresso\core\exceptions\InvalidInterfaceException; |
6 | 6 | use LimitIterator; |
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 | * Class Collection |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | * @param string $collection_interface |
37 | 37 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
38 | 38 | */ |
39 | - public function __construct( $collection_interface ) { |
|
40 | - $this->setCollectionInterface( $collection_interface ); |
|
39 | + public function __construct($collection_interface) { |
|
40 | + $this->setCollectionInterface($collection_interface); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | * @param string $collection_interface |
50 | 50 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
51 | 51 | */ |
52 | - protected function setCollectionInterface( $collection_interface ) { |
|
53 | - if ( ! ( interface_exists( $collection_interface ) || class_exists( $collection_interface ) ) ) { |
|
54 | - throw new InvalidInterfaceException( $collection_interface ); |
|
52 | + protected function setCollectionInterface($collection_interface) { |
|
53 | + if ( ! (interface_exists($collection_interface) || class_exists($collection_interface))) { |
|
54 | + throw new InvalidInterfaceException($collection_interface); |
|
55 | 55 | } |
56 | 56 | $this->collection_interface = $collection_interface; |
57 | 57 | } |
@@ -70,13 +70,13 @@ discard block |
||
70 | 70 | * @return bool |
71 | 71 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
72 | 72 | */ |
73 | - public function add( $object, $identifier = null ) { |
|
74 | - if ( ! $object instanceof $this->collection_interface ) { |
|
75 | - throw new InvalidEntityException( $object, $this->collection_interface ); |
|
73 | + public function add($object, $identifier = null) { |
|
74 | + if ( ! $object instanceof $this->collection_interface) { |
|
75 | + throw new InvalidEntityException($object, $this->collection_interface); |
|
76 | 76 | } |
77 | - $this->attach( $object ); |
|
78 | - $this->setIdentifier( $object, $identifier ); |
|
79 | - return $this->contains( $object ); |
|
77 | + $this->attach($object); |
|
78 | + $this->setIdentifier($object, $identifier); |
|
79 | + return $this->contains($object); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | * @param mixed $identifier |
93 | 93 | * @return bool |
94 | 94 | */ |
95 | - public function setIdentifier( $object, $identifier = null ) { |
|
96 | - $identifier = ! empty( $identifier ) ? $identifier : spl_object_hash( $object ); |
|
95 | + public function setIdentifier($object, $identifier = null) { |
|
96 | + $identifier = ! empty($identifier) ? $identifier : spl_object_hash($object); |
|
97 | 97 | $this->rewind(); |
98 | - while ( $this->valid() ) { |
|
99 | - if ( $object === $this->current() ) { |
|
100 | - $this->setInfo( $identifier ); |
|
98 | + while ($this->valid()) { |
|
99 | + if ($object === $this->current()) { |
|
100 | + $this->setInfo($identifier); |
|
101 | 101 | $this->rewind(); |
102 | 102 | return true; |
103 | 103 | } |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | * @param mixed $identifier |
118 | 118 | * @return mixed |
119 | 119 | */ |
120 | - public function get( $identifier ) { |
|
120 | + public function get($identifier) { |
|
121 | 121 | $this->rewind(); |
122 | - while ( $this->valid() ) { |
|
123 | - if ( $identifier === $this->getInfo() ) { |
|
122 | + while ($this->valid()) { |
|
123 | + if ($identifier === $this->getInfo()) { |
|
124 | 124 | $object = $this->current(); |
125 | 125 | $this->rewind(); |
126 | 126 | return $object; |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | * @param mixed $identifier |
143 | 143 | * @return bool |
144 | 144 | */ |
145 | - public function has( $identifier ) { |
|
145 | + public function has($identifier) { |
|
146 | 146 | $this->rewind(); |
147 | - while ( $this->valid() ) { |
|
148 | - if ( $identifier === $this->getInfo() ) { |
|
147 | + while ($this->valid()) { |
|
148 | + if ($identifier === $this->getInfo()) { |
|
149 | 149 | $this->rewind(); |
150 | 150 | return true; |
151 | 151 | } |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | * @param $object |
165 | 165 | * @return bool |
166 | 166 | */ |
167 | - public function hasObject( $object ) { |
|
168 | - return $this->contains( $object ); |
|
167 | + public function hasObject($object) { |
|
168 | + return $this->contains($object); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param $object |
179 | 179 | * @return bool |
180 | 180 | */ |
181 | - public function remove( $object ) { |
|
182 | - $this->detach( $object ); |
|
181 | + public function remove($object) { |
|
182 | + $this->detach($object); |
|
183 | 183 | return true; |
184 | 184 | } |
185 | 185 | |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | * @param mixed $identifier |
194 | 194 | * @return boolean |
195 | 195 | */ |
196 | - public function setCurrent( $identifier ) { |
|
196 | + public function setCurrent($identifier) { |
|
197 | 197 | $this->rewind(); |
198 | - while ( $this->valid() ) { |
|
199 | - if ( $identifier === $this->getInfo() ) { |
|
198 | + while ($this->valid()) { |
|
199 | + if ($identifier === $this->getInfo()) { |
|
200 | 200 | return true; |
201 | 201 | } |
202 | 202 | $this->next(); |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | * @param $object |
215 | 215 | * @return boolean |
216 | 216 | */ |
217 | - public function setCurrentUsingObject( $object ) { |
|
217 | + public function setCurrentUsingObject($object) { |
|
218 | 218 | $this->rewind(); |
219 | - while ( $this->valid() ) { |
|
220 | - if ( $this->current() === $object ) { |
|
219 | + while ($this->valid()) { |
|
220 | + if ($this->current() === $object) { |
|
221 | 221 | return true; |
222 | 222 | } |
223 | 223 | $this->next(); |
@@ -234,12 +234,12 @@ discard block |
||
234 | 234 | * @return mixed |
235 | 235 | */ |
236 | 236 | public function previous() { |
237 | - $index = $this->indexOf( $this->current() ); |
|
238 | - if ( $index === 0 ) { |
|
237 | + $index = $this->indexOf($this->current()); |
|
238 | + if ($index === 0) { |
|
239 | 239 | return $this->current(); |
240 | 240 | } |
241 | 241 | $index--; |
242 | - return $this->objectAtIndex( $index ); |
|
242 | + return $this->objectAtIndex($index); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | * @param $object |
252 | 252 | * @return boolean|int|string |
253 | 253 | */ |
254 | - public function indexOf( $object ) { |
|
255 | - if ( ! $this->contains( $object ) ) { |
|
254 | + public function indexOf($object) { |
|
255 | + if ( ! $this->contains($object)) { |
|
256 | 256 | return false; |
257 | 257 | } |
258 | - foreach ( $this as $index => $obj ) { |
|
259 | - if ( $obj === $object ) { |
|
258 | + foreach ($this as $index => $obj) { |
|
259 | + if ($obj === $object) { |
|
260 | 260 | return $index; |
261 | 261 | } |
262 | 262 | } |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | * @param int $index |
273 | 273 | * @return mixed |
274 | 274 | */ |
275 | - public function objectAtIndex( $index ) { |
|
276 | - $iterator = new LimitIterator( $this, $index, 1 ); |
|
275 | + public function objectAtIndex($index) { |
|
276 | + $iterator = new LimitIterator($this, $index, 1); |
|
277 | 277 | $iterator->rewind(); |
278 | 278 | return $iterator->current(); |
279 | 279 | } |
@@ -288,10 +288,10 @@ discard block |
||
288 | 288 | * @param int $length |
289 | 289 | * @return array |
290 | 290 | */ |
291 | - public function slice( $offset, $length ) { |
|
291 | + public function slice($offset, $length) { |
|
292 | 292 | $slice = array(); |
293 | - $iterator = new LimitIterator( $this, $offset, $length ); |
|
294 | - foreach ( $iterator as $object ) { |
|
293 | + $iterator = new LimitIterator($this, $offset, $length); |
|
294 | + foreach ($iterator as $object) { |
|
295 | 295 | $slice[] = $object; |
296 | 296 | } |
297 | 297 | return $slice; |
@@ -306,35 +306,35 @@ discard block |
||
306 | 306 | * @param mixed $objects A single object or an array of objects |
307 | 307 | * @param int $index |
308 | 308 | */ |
309 | - public function insertAt( $objects, $index ) { |
|
310 | - if ( ! is_array( $objects ) ) { |
|
311 | - $objects = array( $objects ); |
|
309 | + public function insertAt($objects, $index) { |
|
310 | + if ( ! is_array($objects)) { |
|
311 | + $objects = array($objects); |
|
312 | 312 | } |
313 | 313 | // check to ensure that objects don't already exist in the collection |
314 | - foreach ( $objects as $key => $object ) { |
|
315 | - if ( $this->contains( $object ) ) { |
|
316 | - unset( $objects[ $key ] ); |
|
314 | + foreach ($objects as $key => $object) { |
|
315 | + if ($this->contains($object)) { |
|
316 | + unset($objects[$key]); |
|
317 | 317 | } |
318 | 318 | } |
319 | 319 | // do we have any objects left? |
320 | - if ( ! $objects ) { |
|
320 | + if ( ! $objects) { |
|
321 | 321 | return; |
322 | 322 | } |
323 | 323 | // detach any objects at or past this index |
324 | 324 | $remaining = array(); |
325 | - if ( $index < $this->count() ) { |
|
326 | - $remaining = $this->slice( $index, $this->count() - $index ); |
|
327 | - foreach ( $remaining as $object ) { |
|
328 | - $this->detach( $object ); |
|
325 | + if ($index < $this->count()) { |
|
326 | + $remaining = $this->slice($index, $this->count() - $index); |
|
327 | + foreach ($remaining as $object) { |
|
328 | + $this->detach($object); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | // add the new objects we're splicing in |
332 | - foreach ( $objects as $object ) { |
|
333 | - $this->attach( $object ); |
|
332 | + foreach ($objects as $object) { |
|
333 | + $this->attach($object); |
|
334 | 334 | } |
335 | 335 | // attach the objects we previously detached |
336 | - foreach ( $remaining as $object ) { |
|
337 | - $this->attach( $object ); |
|
336 | + foreach ($remaining as $object) { |
|
337 | + $this->attach($object); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | * @see http://stackoverflow.com/a/8736013 |
347 | 347 | * @param int $index |
348 | 348 | */ |
349 | - public function removeAt( $index ) { |
|
350 | - $this->detach( $this->objectAtIndex( $index ) ); |
|
349 | + public function removeAt($index) { |
|
350 | + $this->detach($this->objectAtIndex($index)); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * by calling EE_Object_Collection::set_identifier() |
66 | 66 | * |
67 | 67 | * @access public |
68 | - * @param $object |
|
68 | + * @param \EventEspresso\core\services\progress_steps\ProgressStep $object |
|
69 | 69 | * @param mixed $identifier |
70 | 70 | * @return bool |
71 | 71 | * @throws \EventEspresso\core\exceptions\InvalidEntityException |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * advances pointer to the provided object |
212 | 212 | * |
213 | 213 | * @access public |
214 | - * @param $object |
|
214 | + * @param \EventEspresso\core\libraries\form_sections\form_handlers\SequentialStepFormInterface $object |
|
215 | 215 | * @return boolean |
216 | 216 | */ |
217 | 217 | public function setCurrentUsingObject( $object ) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @see http://stackoverflow.com/a/8736013 |
251 | 251 | * @param $object |
252 | - * @return boolean|int|string |
|
252 | + * @return integer |
|
253 | 253 | */ |
254 | 254 | public function indexOf( $object ) { |
255 | 255 | if ( ! $this->contains( $object ) ) { |
@@ -1,6 +1,6 @@ |
||
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 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | use EventEspresso\core\services\collections\Collection; |
5 | 5 | |
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 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @throws \EventEspresso\Core\Exceptions\InvalidInterfaceException |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - parent::__construct( '\EventEspresso\core\services\progress_steps\ProgressStepInterface' ); |
|
30 | + parent::__construct('\EventEspresso\core\services\progress_steps\ProgressStepInterface'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\progress_steps; |
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 |
||
22 | 22 | /** |
23 | 23 | * @param boolean $is_current |
24 | 24 | */ |
25 | - public function setIsCurrent( $is_current = true ); |
|
25 | + public function setIsCurrent($is_current = true); |
|
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @return int|string |