Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Returns a parent directory's path
<?php dirname(string $path, int $levels = 1): string
<?php public function metaPath()
{
$path = dirname($this->path()).'/.meta/'.$this->basename().'.yaml';
return ltrim($path, '/');
}
<?php }
if (($dir = dirname($path)) !== '.') {
$this->add($dir);
}
<?php protected function putResets($resets)
{
if (! $this->files->isDirectory($dir = dirname($this->path))) {
$this->files->makeDirectory($dir);
}
<?php protected function makeDirectory($path)
{
$directory = $this->files->isDirectory($path) ? $path : dirname($path);
if (! $this->files->exists($directory)) {
$this->files->makeDirectory($directory, 0777, true, true);
<?php return;
}
$backupPath = dirname($file).'/'.UpdateScript::BACKUP_PATH;
if (! is_dir($backupDir = dirname($backupPath))) {
mkdir($backupDir, 0777, true);
<?php $backupPath = dirname($file).'/'.UpdateScript::BACKUP_PATH;
if (! is_dir($backupDir = dirname($backupPath))) {
mkdir($backupDir, 0777, true);
}
<?php public function deleteFile()
{
File::delete($this->path());
File::delete(dirname($this->path()).'/'.$this->handle);
}
public static function __callStatic($method, $parameters)
<?php $reflector = new ReflectionClass($this->provider);
$dir = Str::removeRight(dirname($reflector->getFileName()), rtrim($this->autoload, '/'));
return $this->directory = Str::ensureRight($dir, '/');
}
<?php $namespace = implode('\\', $providerParts);
$autoload = $package['autoload']['psr-4'][$namespace.'\\'];
$directory = Str::removeRight(dirname($reflector->getFileName()), rtrim($autoload, '/'));
$json = json_decode(File::get($directory.'/composer.json'), true);
$statamic = $json['extra']['statamic'] ?? [];
<?php public function write($path, $content, $lockFor = 0)
{
@mkdir(dirname($path), 0777, true);
<?php $contents = "<?php\n\nreturn ".VarExporter::export($translations).";\n";
$this->files->makeDirectory(dirname($fullPath), 0755, true, true);
$this->files->put($fullPath, $contents);
$this->output->writeln($exists
<?php private function multiSiteNavTrees($nav)
{
$dir = dirname($nav->path());
return Site::all()->map(function ($site) use ($dir, $nav) {
$path = $dir.'/'.$site->handle().'/'.$nav->handle().'.yaml';
<?php $entry = (new Entry)->collection($collection)->slug('bar');
$path = $entry->path();
$date = Carbon::parse('2017-01-02');
mkdir(dirname($path));
touch($path, $date->timestamp);
$this->assertTrue($date->eq($entry->lastModified()));