Completed
Push — master ( b86345...d632d5 )
by Maxim
02:34
created
src/assets/AssetManager.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -82,12 +82,12 @@  discard block
 block discarded – undo
82 82
     public function getPath(string $assetClass, $file, bool $absolute = false): string
83 83
     {
84 84
         if (!isset($this->assets[$assetClass])) {
85
-            throw new Exception('Asset ' . $assetClass . ' is not registered');
85
+            throw new Exception('Asset '.$assetClass.' is not registered');
86 86
         }
87 87
 
88 88
         return $absolute
89
-            ? $this->webRoot . $this->getWebDir($this->assets[$assetClass]) . \ltrim($file, '/')
90
-            : $this->getWebDir($this->assets[$assetClass]) . \ltrim($file, '/');
89
+            ? $this->webRoot.$this->getWebDir($this->assets[$assetClass]).\ltrim($file, '/')
90
+            : $this->getWebDir($this->assets[$assetClass]).\ltrim($file, '/');
91 91
     }
92 92
 
93 93
     /**
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         foreach ($this->assets as $asset) {
100 100
             $links = $this->getLinks($asset, $asset->css());
101 101
             foreach ($links as $link) {
102
-                $result[] = '<link rel="stylesheet" href="' . $link . '">';
102
+                $result[] = '<link rel="stylesheet" href="'.$link.'">';
103 103
             }
104 104
         }
105 105
         return \implode('', $result);
@@ -112,15 +112,15 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $result = [];
114 114
         foreach ($this->assets as $asset) {
115
-            $productionJs = $this->getWebDir($asset) . self::PRODUCTION_JS;
116
-            if ($this->isProduction() && \file_exists($this->webRoot . $productionJs)) {
115
+            $productionJs = $this->getWebDir($asset).self::PRODUCTION_JS;
116
+            if ($this->isProduction() && \file_exists($this->webRoot.$productionJs)) {
117 117
                 $links = $this->getLinks($asset, $asset->externalJs());
118 118
                 $links[] = $productionJs;
119 119
             } else {
120 120
                 $links = $this->getLinks($asset, $asset->js());
121 121
             }
122 122
             foreach ($links as $link) {
123
-                $result[] = '<script src="' . $link . '"></script>';
123
+                $result[] = '<script src="'.$link.'"></script>';
124 124
             }
125 125
         }
126 126
         return \implode('', $result);
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     protected function publishAsset(AbstractAsset $asset)
151 151
     {
152 152
         $hash = $asset->getHash();
153
-        $dir = $this->webRoot . '/' . $this->assetDirName . '/' . $hash;
153
+        $dir = $this->webRoot.'/'.$this->assetDirName.'/'.$hash;
154 154
         if ($asset->useLinks) {
155 155
             if (!$this->filesystem->exists($dir)) {
156 156
                 $this->filesystem->symlink($asset->getBasePath(), $dir, true);
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
     private function getWebDir(AbstractAsset $asset): string
173 173
     {
174 174
         return $asset->publish
175
-            ? '/' . $this->assetDirName . '/' . $asset->getHash() . '/'
175
+            ? '/'.$this->assetDirName.'/'.$asset->getHash().'/'
176 176
             : '/';
177 177
     }
178 178
 
@@ -202,9 +202,9 @@  discard block
 block discarded – undo
202 202
     {
203 203
         $link = $file;
204 204
         if (false === \strpos($file, 'http') && false === \strpos($file, '//')) {
205
-            $filePath = $dir . \ltrim($file, '/');
206
-            $timestamp = \filemtime($this->webRoot . $filePath);
207
-            $link = $filePath . '?' . $timestamp;
205
+            $filePath = $dir.\ltrim($file, '/');
206
+            $timestamp = \filemtime($this->webRoot.$filePath);
207
+            $link = $filePath.'?'.$timestamp;
208 208
         }
209 209
 
210 210
         return $link;
Please login to merge, or discard this patch.