/
githubmirror
/
framework
Обзор
Документация
Войти
/
githubmirror
/
framework
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
13.x
src/Illuminate/Http/FileHelpers.php
66 строк
1 KB
Matthieu
docs: correct FileHelpers extension return type (#60515)
16 июн 2026, 00:10
Не верифицирован
16 июн 2026, 00:10
8ceeca5
Код
Авторство
О чём код?
<?php namespace Illuminate\Http; use Illuminate\Support\Str; trait FileHelpers { /** * The cache copy of the file's hash name. * * @var string|null */ protected $hashName = null; /** * Get the fully-qualified path to the file. * * @return string */ public function path() { return $this->getRealPath(); } /** * Get the file's extension. * * @return string|null */ public function extension() { return $this->guessExtension(); } /** * Get a filename for the file. * * @param string|null $path * @return string */ public function hashName($path = null) { if ($path) { $path = rtrim($path, '/').'/'; } $hash = $this->hashName ?: $this->hashName = Str::random(40); if ($extension = $this->guessExtension()) { $extension = '.'.$extension; } return $path.$hash.$extension; } /** * Get the dimensions of the image (if applicable). * * @return array|null */ public function dimensions() { return @getimagesize($this->getRealPath()); } }