Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Returns trailing name component of path
basename(string $path, string $suffix = ""): string
public function getMigrationName($path)
{
return str_replace('.php', '', basename($path));
}
{
return str_replace('.php', '', basename($path));
}
$path = realpath($path) ?: $path;
$tempPath = tempnam(dirname($path), basename($path));
chmod($tempPath, 0777 - umask());
$tempPath = tempnam(dirname($path), basename($path));
chmod($tempPath, 0777 - umask());
}
if (! array_key_exists('Content-Disposition', $headers)) {
$filename = $name ?? basename($path);
$disposition = $response->headers->makeDisposition(
$disposition, $filename, $this->fallbackName($filename)
if (! array_key_exists('Content-Disposition', $headers)) {
$filename = $name ?? basename($path);
$disposition = $response->headers->makeDisposition(
$disposition, $filename, $this->fallbackName($filename)
foreach (Finder::create()->files()->name('*.php')->in($configPath) as $file) {
$directory = $this->getNestedDirectory($file, $configPath);
$files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
}
ksort($files, SORT_NATURAL);
$directory = $this->getNestedDirectory($file, $configPath);
$files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
}
ksort($files, SORT_NATURAL);
$class = trim(Str::replaceFirst($basePath, '', $file->getRealPath()), DIRECTORY_SEPARATOR);
return str_replace(
[DIRECTORY_SEPARATOR, ucfirst(basename(app()->path())).'\\'],
['\\', app()->getNamespace()],
ucfirst(Str::replaceLast('.php', '', $class))
);
return str_replace(
[DIRECTORY_SEPARATOR, ucfirst(basename(app()->path())).'\\'],
['\\', app()->getNamespace()],
ucfirst(Str::replaceLast('.php', '', $class))
);
)->disk($disk);
$attachment
->as($attachment->as ?? basename($path))
->withMime($attachment->mime ?? $storage->mimeType($path));
return $dataStrategy(fn () => $storage->get($path), $attachment);
$attachment
->as($attachment->as ?? basename($path))
->withMime($attachment->mime ?? $storage->mimeType($path));
return $dataStrategy(fn () => $storage->get($path), $attachment);
$message->attachData(
$storage->get($attachment['path']),
$attachment['name'] ?? basename($attachment['path']),
array_merge(['mime' => $storage->mimeType($attachment['path'])], $attachment['options'])
);
}
$storage->get($attachment['path']),
$attachment['name'] ?? basename($attachment['path']),
array_merge(['mime' => $storage->mimeType($attachment['path'])], $attachment['options'])
);
}
$this->diskAttachments = collect($this->diskAttachments)->push([
'disk' => $disk,
'path' => $path,
'name' => $name ?? basename($path),
'options' => $options,
])->unique(function ($file) {
return $file['name'].$file['disk'].$file['path'];
'disk' => $disk,
'path' => $path,
'name' => $name ?? basename($path),
'options' => $options,
])->unique(function ($file) {
return $file['name'].$file['disk'].$file['path'];
{
$reflection = new ReflectionFunction($this->closure->getClosure());
return 'Closure ('.basename($reflection->getFileName()).':'.$reflection->getStartLine().')';
}
}
$reflection = new ReflectionFunction($this->closure->getClosure());
return 'Closure ('.basename($reflection->getFileName()).':'.$reflection->getStartLine().')';
}
}
{
$class = is_object($class) ? get_class($class) : $class;
return basename(str_replace('\\', '/', $class));
}
}
$class = is_object($class) ? get_class($class) : $class;
return basename(str_replace('\\', '/', $class));
}
}
public function basename($suffix = '')
{
return new static(basename($this->value, $suffix));
}
{
return new static(basename($this->value, $suffix));
}
file_put_contents($viewFile, $contents);
}
return '__components::'.basename($viewFile, '.blade.php');
}
}
return '__components::'.basename($viewFile, '.blade.php');
}
$filesystem = new Filesystem(
$this->adapter = new LocalFilesystemAdapter(dirname($this->tempDir))
);
$filesystem->deleteDirectory(basename($this->tempDir));
m::close();
unset($this->tempDir, $this->filesystem, $this->adapter);
$this->adapter = new LocalFilesystemAdapter(dirname($this->tempDir))
);
$filesystem->deleteDirectory(basename($this->tempDir));
m::close();
unset($this->tempDir, $this->filesystem, $this->adapter);
$v = new Validator($trans, ['foo' => [1, 2, 3]], ['foo' => 'Array|Max:2']);
$this->assertFalse($v->passes());
$file = $this->getMockBuilder(UploadedFile::class)->onlyMethods(['isValid', 'getSize'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
$file->method('isValid')->willReturn(true);
$file->method('getSize')->willReturn(3072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:10']);
$this->assertFalse($v->passes());
$file = $this->getMockBuilder(UploadedFile::class)->onlyMethods(['isValid', 'getSize'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
$file->method('isValid')->willReturn(true);
$file->method('getSize')->willReturn(3072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:10']);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:10']);
$this->assertTrue($v->passes());
$file = $this->getMockBuilder(UploadedFile::class)->onlyMethods(['isValid', 'getSize'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
$file->method('isValid')->willReturn(true);
$file->method('getSize')->willReturn(4072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:2']);
$this->assertTrue($v->passes());
$file = $this->getMockBuilder(UploadedFile::class)->onlyMethods(['isValid', 'getSize'])->setConstructorArgs([__FILE__, basename(__FILE__)])->getMock();
$file->method('isValid')->willReturn(true);
$file->method('getSize')->willReturn(4072);
$v = new Validator($trans, ['photo' => $file], ['photo' => 'Max:2']);