@@ -67,7 +67,7 @@ |
||
67 | 67 | */ |
68 | 68 | protected static function getTempFile(string $content) |
69 | 69 | { |
70 | - $stream = fopen('php://memory','rb+'); |
|
70 | + $stream = fopen('php://memory', 'rb+'); |
|
71 | 71 | fwrite($stream, $content); // write file into stream |
72 | 72 | rewind($stream); // reset stream pointer to start |
73 | 73 |
@@ -91,16 +91,16 @@ |
||
91 | 91 | public function rules(): array |
92 | 92 | { |
93 | 93 | return [ |
94 | - ['model', function ($attribute) { |
|
94 | + ['model', function($attribute) { |
|
95 | 95 | if ($this->$attribute->isNewRecord || $this->$attribute->id === null) { |
96 | 96 | $this->$attribute->addError($attribute, 'Parent model must be saved.'); |
97 | 97 | } |
98 | 98 | }], |
99 | 99 | [ |
100 | 100 | 'fileArray', |
101 | - function ($attribute) { |
|
101 | + function($attribute) { |
|
102 | 102 | // max count |
103 | - $fileArray = array_filter($this->fileArray, function (File $file) { |
|
103 | + $fileArray = array_filter($this->fileArray, function(File $file) { |
|
104 | 104 | return $file->isActual(); |
105 | 105 | }); |
106 | 106 | if (\count($fileArray) > $this->aliasConfig['maxCount']) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @param null|string $extension |
86 | 86 | * @return string returns default icon if nothing found |
87 | 87 | */ |
88 | - public function getIcon(?string $extension): ?string |
|
88 | + public function getIcon(?string $extension) : ?string |
|
89 | 89 | { |
90 | 90 | $iconClass = $this->iconSet[$this->getIconType($extension)] ?? null; |
91 | 91 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param null|string $extension |
100 | 100 | * @return string |
101 | 101 | */ |
102 | - public function getIconType(?string $extension): string |
|
102 | + public function getIconType(?string $extension) : string |
|
103 | 103 | { |
104 | 104 | if ($extension !== null && $extension !== '') { |
105 | 105 | foreach (self::TYPE_TO_REGEX as $type => $regex) { |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @var array |
24 | 24 | */ |
25 | 25 | public static $iconPreviewArray = [ |
26 | - 'file' => ['txt', 'doc',], |
|
26 | + 'file' => ['txt', 'doc', ], |
|
27 | 27 | ]; |
28 | 28 | |
29 | 29 | /** |
@@ -129,7 +129,7 @@ |
||
129 | 129 | * @param null|string $extension |
130 | 130 | * @return string |
131 | 131 | */ |
132 | - public function getIcon(?string $extension): ?string |
|
132 | + public function getIcon(?string $extension) : ?string |
|
133 | 133 | { |
134 | 134 | return $this->iconGenerator->getIcon($extension); |
135 | 135 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | public static function tableName(): string |
47 | 47 | { |
48 | 48 | // TODO: how to defined it outside via any type of config? |
49 | - return '{{%file}}'; |
|
49 | + return '{{%file}}'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -82,7 +82,7 @@ |
||
82 | 82 | // filters |
83 | 83 | [ |
84 | 84 | 'name', |
85 | - function ($attribute) { |
|
85 | + function($attribute) { |
|
86 | 86 | $name = $this->$attribute ?: static::DEFAULT_FILENAME; |
87 | 87 | // remove all wrong characters |
88 | 88 | $name = preg_replace('/[^A-zА-я0-9\s]+/u', '-', $name); |
@@ -124,7 +124,7 @@ |
||
124 | 124 | $uploadedFile, |
125 | 125 | $this->fileManager->getAliasConfig($this->ownerModelAlias), |
126 | 126 | $this->contentFS, |
127 | - [ // other config |
|
127 | + [// other config |
|
128 | 128 | 'parent_model' => $this->ownerModelAlias, |
129 | 129 | 'parent_model_id' => $this->ownerId, |
130 | 130 | ]); |
@@ -176,6 +176,6 @@ |
||
176 | 176 | $options['height'] = $height; |
177 | 177 | } |
178 | 178 | |
179 | - return [$fileType, $options,]; |
|
179 | + return [$fileType, $options, ]; |
|
180 | 180 | } |
181 | 181 | } |