Completed
Pull Request — Gutenberg/master (#479)
by Darren
18:46 queued 02:02
created
core/services/assets/AssetCollection.php 1 patch
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -21,201 +21,201 @@
 block discarded – undo
21 21
 {
22 22
 
23 23
 
24
-    /**
25
-     * AssetCollection constructor
26
-     *
27
-     * @throws InvalidInterfaceException
28
-     */
29
-    public function __construct()
30
-    {
31
-        parent::__construct('EventEspresso\core\domain\values\assets\Asset');
32
-    }
33
-
34
-
35
-    /**
36
-     * @return StylesheetAsset[]
37
-     * @since 4.9.62.p
38
-     */
39
-    public function getStylesheetAssets()
40
-    {
41
-        return $this->getAssetsOfType(Asset::TYPE_CSS);
42
-    }
43
-
44
-
45
-    /**
46
-     * @return JavascriptAsset[]
47
-     * @since 4.9.62.p
48
-     */
49
-    public function getJavascriptAssets()
50
-    {
51
-        return $this->getAssetsOfType(Asset::TYPE_JS);
52
-    }
53
-
54
-
55
-    /**
56
-     * @return ManifestFile[]
57
-     * @since 4.9.62.p
58
-     */
59
-    public function getManifestFiles()
60
-    {
61
-        return $this->getAssetsOfType(Asset::TYPE_MANIFEST);
62
-    }
63
-
64
-
65
-    /**
66
-     * @param $type
67
-     * @return JavascriptAsset[]|StylesheetAsset[]|ManifestFile[]
68
-     * @since 4.9.62.p
69
-     */
70
-    protected function getAssetsOfType($type)
71
-    {
72
-        $files = array();
73
-        $this->rewind();
74
-        while ($this->valid()) {
75
-            /** @var Asset $asset */
76
-            $asset = $this->current();
77
-            if ($asset->type() === $type) {
78
-                $files[ $asset->handle() ] = $asset;
79
-            }
80
-            $this->next();
81
-        }
82
-        $this->rewind();
83
-        return $files;
84
-    }
85
-
86
-
87
-    /**
88
-     * @return JavascriptAsset[]
89
-     * @since 4.9.62.p
90
-     */
91
-    public function getJavascriptAssetsWithData()
92
-    {
93
-        $files = array();
94
-        $this->rewind();
95
-        while ($this->valid()) {
96
-            /** @var JavascriptAsset $asset */
97
-            $asset = $this->current();
98
-            if ($asset->type() === Asset::TYPE_JS && $asset->hasInlineData()) {
99
-                $files[ $asset->handle() ] = $asset;
100
-            }
101
-            $this->next();
102
-        }
103
-        $this->rewind();
104
-        return $files;
105
-    }
106
-
107
-
108
-    /**
109
-     * has
110
-     * returns TRUE or FALSE
111
-     * depending on whether the object is within the Collection
112
-     * based on the supplied $identifier and type
113
-     *
114
-     * @param  mixed $identifier
115
-     * @param string $type
116
-     * @return bool
117
-     * @since $VID:$
118
-     */
119
-    public function hasAssetOfType($identifier, $type = Asset::TYPE_JS)
120
-    {
121
-        $this->rewind();
122
-        while ($this->valid()) {
123
-            if ($this->getInfo() === $identifier && $this->current()->type() === $type) {
124
-                $this->rewind();
125
-                return true;
126
-            }
127
-            $this->next();
128
-        }
129
-        return false;
130
-    }
131
-
132
-
133
-    /**
134
-     * has
135
-     * returns TRUE or FALSE
136
-     * depending on whether the Stylesheet Asset is within the Collection
137
-     * based on the supplied $identifier
138
-     *
139
-     * @param  mixed $identifier
140
-     * @return bool
141
-     * @since $VID:$
142
-     */
143
-    public function hasStylesheetAsset($identifier)
144
-    {
145
-        return $this->hasAssetOfType($identifier, Asset::TYPE_CSS);
146
-    }
147
-
148
-
149
-    /**
150
-     * has
151
-     * returns TRUE or FALSE
152
-     * depending on whether the Javascript Asset is within the Collection
153
-     * based on the supplied $identifier
154
-     *
155
-     * @param  mixed $identifier
156
-     * @return bool
157
-     * @since $VID:$
158
-     */
159
-    public function hasJavascriptAsset($identifier)
160
-    {
161
-        return $this->hasAssetOfType($identifier, Asset::TYPE_JS);
162
-    }
163
-
164
-    /**
165
-     * has
166
-     * returns TRUE or FALSE
167
-     * depending on whether the object is within the Collection
168
-     * based on the supplied $identifier and type
169
-     *
170
-     * @param  mixed $identifier
171
-     * @param string $type
172
-     * @return JavascriptAsset|StylesheetAsset
173
-     * @since $VID:$
174
-     */
175
-    public function getAssetOfType($identifier, $type = Asset::TYPE_JS)
176
-    {
177
-        $this->rewind();
178
-        while ($this->valid()) {
179
-            if ($this->getInfo() === $identifier && $this->current()->type() === $type) {
180
-                /** @var JavascriptAsset|StylesheetAsset $object */
181
-                $object = $this->current();
182
-                $this->rewind();
183
-                return $object;
184
-            }
185
-            $this->next();
186
-        }
187
-        return null;
188
-    }
189
-
190
-
191
-    /**
192
-     * has
193
-     * returns TRUE or FALSE
194
-     * depending on whether the Stylesheet Asset is within the Collection
195
-     * based on the supplied $identifier
196
-     *
197
-     * @param  mixed $identifier
198
-     * @return StylesheetAsset
199
-     * @since $VID:$
200
-     */
201
-    public function getStylesheetAsset($identifier)
202
-    {
203
-        return $this->getAssetOfType($identifier, Asset::TYPE_CSS);
204
-    }
205
-
206
-
207
-    /**
208
-     * has
209
-     * returns TRUE or FALSE
210
-     * depending on whether the Javascript Asset is within the Collection
211
-     * based on the supplied $identifier
212
-     *
213
-     * @param  mixed $identifier
214
-     * @return JavascriptAsset
215
-     * @since $VID:$
216
-     */
217
-    public function getJavascriptAsset($identifier)
218
-    {
219
-        return $this->getAssetOfType($identifier, Asset::TYPE_JS);
220
-    }
24
+	/**
25
+	 * AssetCollection constructor
26
+	 *
27
+	 * @throws InvalidInterfaceException
28
+	 */
29
+	public function __construct()
30
+	{
31
+		parent::__construct('EventEspresso\core\domain\values\assets\Asset');
32
+	}
33
+
34
+
35
+	/**
36
+	 * @return StylesheetAsset[]
37
+	 * @since 4.9.62.p
38
+	 */
39
+	public function getStylesheetAssets()
40
+	{
41
+		return $this->getAssetsOfType(Asset::TYPE_CSS);
42
+	}
43
+
44
+
45
+	/**
46
+	 * @return JavascriptAsset[]
47
+	 * @since 4.9.62.p
48
+	 */
49
+	public function getJavascriptAssets()
50
+	{
51
+		return $this->getAssetsOfType(Asset::TYPE_JS);
52
+	}
53
+
54
+
55
+	/**
56
+	 * @return ManifestFile[]
57
+	 * @since 4.9.62.p
58
+	 */
59
+	public function getManifestFiles()
60
+	{
61
+		return $this->getAssetsOfType(Asset::TYPE_MANIFEST);
62
+	}
63
+
64
+
65
+	/**
66
+	 * @param $type
67
+	 * @return JavascriptAsset[]|StylesheetAsset[]|ManifestFile[]
68
+	 * @since 4.9.62.p
69
+	 */
70
+	protected function getAssetsOfType($type)
71
+	{
72
+		$files = array();
73
+		$this->rewind();
74
+		while ($this->valid()) {
75
+			/** @var Asset $asset */
76
+			$asset = $this->current();
77
+			if ($asset->type() === $type) {
78
+				$files[ $asset->handle() ] = $asset;
79
+			}
80
+			$this->next();
81
+		}
82
+		$this->rewind();
83
+		return $files;
84
+	}
85
+
86
+
87
+	/**
88
+	 * @return JavascriptAsset[]
89
+	 * @since 4.9.62.p
90
+	 */
91
+	public function getJavascriptAssetsWithData()
92
+	{
93
+		$files = array();
94
+		$this->rewind();
95
+		while ($this->valid()) {
96
+			/** @var JavascriptAsset $asset */
97
+			$asset = $this->current();
98
+			if ($asset->type() === Asset::TYPE_JS && $asset->hasInlineData()) {
99
+				$files[ $asset->handle() ] = $asset;
100
+			}
101
+			$this->next();
102
+		}
103
+		$this->rewind();
104
+		return $files;
105
+	}
106
+
107
+
108
+	/**
109
+	 * has
110
+	 * returns TRUE or FALSE
111
+	 * depending on whether the object is within the Collection
112
+	 * based on the supplied $identifier and type
113
+	 *
114
+	 * @param  mixed $identifier
115
+	 * @param string $type
116
+	 * @return bool
117
+	 * @since $VID:$
118
+	 */
119
+	public function hasAssetOfType($identifier, $type = Asset::TYPE_JS)
120
+	{
121
+		$this->rewind();
122
+		while ($this->valid()) {
123
+			if ($this->getInfo() === $identifier && $this->current()->type() === $type) {
124
+				$this->rewind();
125
+				return true;
126
+			}
127
+			$this->next();
128
+		}
129
+		return false;
130
+	}
131
+
132
+
133
+	/**
134
+	 * has
135
+	 * returns TRUE or FALSE
136
+	 * depending on whether the Stylesheet Asset is within the Collection
137
+	 * based on the supplied $identifier
138
+	 *
139
+	 * @param  mixed $identifier
140
+	 * @return bool
141
+	 * @since $VID:$
142
+	 */
143
+	public function hasStylesheetAsset($identifier)
144
+	{
145
+		return $this->hasAssetOfType($identifier, Asset::TYPE_CSS);
146
+	}
147
+
148
+
149
+	/**
150
+	 * has
151
+	 * returns TRUE or FALSE
152
+	 * depending on whether the Javascript Asset is within the Collection
153
+	 * based on the supplied $identifier
154
+	 *
155
+	 * @param  mixed $identifier
156
+	 * @return bool
157
+	 * @since $VID:$
158
+	 */
159
+	public function hasJavascriptAsset($identifier)
160
+	{
161
+		return $this->hasAssetOfType($identifier, Asset::TYPE_JS);
162
+	}
163
+
164
+	/**
165
+	 * has
166
+	 * returns TRUE or FALSE
167
+	 * depending on whether the object is within the Collection
168
+	 * based on the supplied $identifier and type
169
+	 *
170
+	 * @param  mixed $identifier
171
+	 * @param string $type
172
+	 * @return JavascriptAsset|StylesheetAsset
173
+	 * @since $VID:$
174
+	 */
175
+	public function getAssetOfType($identifier, $type = Asset::TYPE_JS)
176
+	{
177
+		$this->rewind();
178
+		while ($this->valid()) {
179
+			if ($this->getInfo() === $identifier && $this->current()->type() === $type) {
180
+				/** @var JavascriptAsset|StylesheetAsset $object */
181
+				$object = $this->current();
182
+				$this->rewind();
183
+				return $object;
184
+			}
185
+			$this->next();
186
+		}
187
+		return null;
188
+	}
189
+
190
+
191
+	/**
192
+	 * has
193
+	 * returns TRUE or FALSE
194
+	 * depending on whether the Stylesheet Asset is within the Collection
195
+	 * based on the supplied $identifier
196
+	 *
197
+	 * @param  mixed $identifier
198
+	 * @return StylesheetAsset
199
+	 * @since $VID:$
200
+	 */
201
+	public function getStylesheetAsset($identifier)
202
+	{
203
+		return $this->getAssetOfType($identifier, Asset::TYPE_CSS);
204
+	}
205
+
206
+
207
+	/**
208
+	 * has
209
+	 * returns TRUE or FALSE
210
+	 * depending on whether the Javascript Asset is within the Collection
211
+	 * based on the supplied $identifier
212
+	 *
213
+	 * @param  mixed $identifier
214
+	 * @return JavascriptAsset
215
+	 * @since $VID:$
216
+	 */
217
+	public function getJavascriptAsset($identifier)
218
+	{
219
+		return $this->getAssetOfType($identifier, Asset::TYPE_JS);
220
+	}
221 221
 }
Please login to merge, or discard this patch.
core/domain/entities/editor/blocks/widgets/EventAttendees.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -17,58 +17,58 @@
 block discarded – undo
17 17
 class EventAttendees extends Block
18 18
 {
19 19
 
20
-    const BLOCK_TYPE = 'widgets-event-attendees';
20
+	const BLOCK_TYPE = 'widgets-event-attendees';
21 21
 
22
-    /**
23
-     * @var EspressoEventAttendees $shortcode
24
-     */
25
-    protected $shortcode;
22
+	/**
23
+	 * @var EspressoEventAttendees $shortcode
24
+	 */
25
+	protected $shortcode;
26 26
 
27 27
 
28
-    /**
29
-     * EventAttendees constructor.
30
-     *
31
-     * @param CoreBlocksAssetManager $block_asset_manager
32
-     * @param EspressoEventAttendees $shortcode
33
-     */
34
-    public function __construct(CoreBlocksAssetManager $block_asset_manager, EspressoEventAttendees $shortcode)
35
-    {
36
-        parent::__construct($block_asset_manager);
37
-        $this->shortcode = $shortcode;
38
-    }
28
+	/**
29
+	 * EventAttendees constructor.
30
+	 *
31
+	 * @param CoreBlocksAssetManager $block_asset_manager
32
+	 * @param EspressoEventAttendees $shortcode
33
+	 */
34
+	public function __construct(CoreBlocksAssetManager $block_asset_manager, EspressoEventAttendees $shortcode)
35
+	{
36
+		parent::__construct($block_asset_manager);
37
+		$this->shortcode = $shortcode;
38
+	}
39 39
 
40 40
 
41
-    /**
42
-     * Perform any early setup required by the block
43
-     * including setting the block type and supported post types
44
-     *
45
-     * @return void
46
-     */
47
-    public function initialize()
48
-    {
49
-        $this->setBlockType(self::BLOCK_TYPE);
50
-        $this->setSupportedPostTypes(array('espresso_events', 'post', 'page'));
51
-        $this->setAttributes(array());
52
-        $this->setDynamic();
53
-    }
41
+	/**
42
+	 * Perform any early setup required by the block
43
+	 * including setting the block type and supported post types
44
+	 *
45
+	 * @return void
46
+	 */
47
+	public function initialize()
48
+	{
49
+		$this->setBlockType(self::BLOCK_TYPE);
50
+		$this->setSupportedPostTypes(array('espresso_events', 'post', 'page'));
51
+		$this->setAttributes(array());
52
+		$this->setDynamic();
53
+	}
54 54
 
55 55
 
56
-    /**
57
-     * returns the rendered HTML for the block
58
-     *
59
-     * @param array $attributes
60
-     * @return string
61
-     * @throws \EE_Error
62
-     * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
63
-     * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
64
-     * @throws \InvalidArgumentException
65
-     */
66
-    public function renderBlock(array $attributes = array())
67
-    {
68
-        if (! isset($attributes['selectedEventId'])) {
69
-            return '<h2>' . __METHOD__ . '()</h2>' . var_export($attributes, true);
70
-        }
71
-        $attributes['event_id'] = absint($attributes['selectedEventId']);
72
-        return $this->shortcode->processShortcode($attributes);
73
-    }
56
+	/**
57
+	 * returns the rendered HTML for the block
58
+	 *
59
+	 * @param array $attributes
60
+	 * @return string
61
+	 * @throws \EE_Error
62
+	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
63
+	 * @throws \EventEspresso\core\exceptions\InvalidInterfaceException
64
+	 * @throws \InvalidArgumentException
65
+	 */
66
+	public function renderBlock(array $attributes = array())
67
+	{
68
+		if (! isset($attributes['selectedEventId'])) {
69
+			return '<h2>' . __METHOD__ . '()</h2>' . var_export($attributes, true);
70
+		}
71
+		$attributes['event_id'] = absint($attributes['selectedEventId']);
72
+		return $this->shortcode->processShortcode($attributes);
73
+	}
74 74
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@
 block discarded – undo
65 65
      */
66 66
     public function renderBlock(array $attributes = array())
67 67
     {
68
-        if (! isset($attributes['selectedEventId'])) {
69
-            return '<h2>' . __METHOD__ . '()</h2>' . var_export($attributes, true);
68
+        if ( ! isset($attributes['selectedEventId'])) {
69
+            return '<h2>'.__METHOD__.'()</h2>'.var_export($attributes, true);
70 70
         }
71 71
         $attributes['event_id'] = absint($attributes['selectedEventId']);
72 72
         return $this->shortcode->processShortcode($attributes);
Please login to merge, or discard this patch.