diff --git a/src/Assets.php b/src/Assets.php
index 7a58a60..29b59fd 100644
--- a/src/Assets.php
+++ b/src/Assets.php
@@ -116,7 +116,7 @@ public function css()
$output = '';
foreach ($cssCollection as $key => $value) {
- $output .= 'formatAttributes($value['attributes']+['rel'=>'stylesheet']).'href="'.$value['asset'].'">'."\n";
+ $output .= 'formatAttributes($value['attributes']).'href="'.$value['asset'].'">'."\n";
}
return $output;
@@ -133,7 +133,7 @@ public function js()
$output = '';
foreach ($jsCollection as $key => $value) {
- $output .= ''."\n";
+ $output .= ''."\n";
}
return $output;
@@ -147,7 +147,7 @@ public function js()
*/
protected function isAsset($asset)
{
- return is_string($asset) && preg_match('/.\.(css|js|ico)$/i', $asset);
+ return preg_match('/.\.(css|js)$/i', (string)$asset);
}
/**
@@ -158,7 +158,7 @@ protected function isAsset($asset)
*/
protected function isJs($asset)
{
- return is_string($asset) && preg_match('/.\.js$/i', $asset);
+ return preg_match('/.\.js$/i', (string)$asset);
}
/**
@@ -169,7 +169,7 @@ protected function isJs($asset)
*/
protected function isCss($asset)
{
- return is_string($asset) && preg_match('/.\.(css|ico)$/i', $asset);
+ return preg_match('/.\.css$/i', (string)$asset);
}
/**
@@ -180,7 +180,7 @@ protected function isCss($asset)
*/
protected function isBonsai($asset)
{
- return is_array($asset) || (is_string($asset) && preg_match('/bonsai\.json$/i', $asset));
+ return is_array($asset) || preg_match('/bonsai\.json$/i', (string)$asset);
}
/**
@@ -196,7 +196,6 @@ public function add($assets, $namespace = null)
}
$cleanAsset = self::cleanAsset($assets);
-
if (! $this->isAsset($cleanAsset)) {
$this->lastAddedAsset = '';
@@ -212,13 +211,6 @@ public function add($assets, $namespace = null)
if (! in_array($cleanAsset, $collection)) {
$collection[$assets] = is_array($namespace) ? $namespace : ['namespace' => $namespace];
- if ($type === 'css' && preg_match('/.\.ico$/i', $cleanAsset)) {
- $collection[$assets]['attributes'] = ($collection[$assets]['attributes'] ?? []) + [
- 'rel'=>'icon',
- 'type'=>'image/x-icon'
- ];
- }
-
$this->collection->put($type, $collection);
}
@@ -247,28 +239,6 @@ private static function cleanAsset($asset)
return $asset;
}
- /**
- * Return the remainder of a string after the last occurrence of a given value.
- *
- * @param string $subject
- * @param string $search
- * @return string
- */
- public static function afterLast($subject, $search)
- {
- if ($search === '') {
- return $subject;
- }
-
- $position = strrpos($subject, (string) $search);
-
- if ($position === false) {
- return $subject;
- }
-
- return substr($subject, $position + strlen($search));
- }
-
/**
* Parse a bonsai.json file and add the assets to the collection.
*