本文整理汇总了PHP中Illuminate\Filesystem\Filesystem::isDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::isDirectory方法的具体用法?PHP Filesystem::isDirectory怎么用?PHP Filesystem::isDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Filesystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::isDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExtensions
/**
* Extension list.
*
* @return \Illuminate\Support\Collection
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function getExtensions()
{
if ($this->extensions->isEmpty()) {
if ($this->files->isDirectory($this->getExtensionPath()) && !empty($vendors = $this->files->directories($this->getExtensionPath()))) {
collect($vendors)->each(function ($vendor) {
if ($this->files->isDirectory($vendor) && !empty($directories = $this->files->directories($vendor))) {
collect($directories)->each(function ($directory) {
if ($this->files->exists($file = $directory . DIRECTORY_SEPARATOR . 'composer.json')) {
$package = new Collection(json_decode($this->files->get($file), true));
if (Arr::get($package, 'type') == 'notadd-extension' && ($name = Arr::get($package, 'name'))) {
$extension = new Extension($name);
$extension->setAuthor(Arr::get($package, 'authors'));
$extension->setDescription(Arr::get($package, 'description'));
if ($entries = data_get($package, 'autoload.psr-4')) {
foreach ($entries as $namespace => $entry) {
$extension->setEntry($namespace . 'Extension');
}
}
$this->extensions->put($directory, $extension);
}
}
});
}
});
}
}
return $this->extensions;
}
示例2: createModulesDir
/**
* Creates the modules directory if it doesn't already exist.
*/
protected function createModulesDir()
{
$path = base_path('Modules');
if (!$this->filesystem->isDirectory($path)) {
$this->filesystem->makeDirectory($path);
}
}
示例3: makeDir
/**
* Make directory.
*
* @param string $directory
* @return void
*/
protected function makeDir($directory)
{
if (!$this->files->isDirectory($directory)) {
$this->info('Creating directory ' . $directory);
$this->files->makeDirectory($directory, 0777, true);
}
}
示例4: publish
/**
* Publishes all themes files in the given package to their
* respective themes.
*
* @param string $source
* @return bool
* @throws \InvalidArgumentException
* @throws \RuntimeException
*/
public function publish($source)
{
if (!$this->filesystem->isDirectory($source)) {
throw new InvalidArgumentException("Source [{$source}] does not exist.");
}
$paths = $this->getThemeSourcePaths($source);
foreach ($paths as $path) {
$relativePath = str_replace(str_finish($source, '/'), '', $path);
$slugs = $this->extractSlugsFromPath($relativePath);
// If we cannot resolve a theme, the user has probably got assets
// for a theme which isn't in this installation. Let's not punish
// them for supporting more than the installed themes, we'll just
// let them know we've skipped it.
try {
$theme = $this->getThemeForSlugs($slugs);
} catch (RuntimeException $e) {
$this->note(sprintf('Couln\'t load theme for slug(s) [%s] in source [%s], skipping.', implode(', ', $slugs), $source));
continue;
}
$mappings = $this->getCopyMappings($path, $theme);
foreach ($mappings as $_source => $destination) {
$success = $this->filesystem->copyDirectory($_source, $destination);
if (!$success) {
throw new RuntimeException("Failed to publish [{$_source}] to [{$destination}].");
}
}
}
return true;
}
示例5: createDirectory
protected function createDirectory()
{
$directory = $this->getDirectory();
if (!$this->files->isDirectory($directory)) {
$this->files->makeDirectory($directory, 0755, true);
}
}
示例6: makeDir
/**
* Make directory.
*
* @param string $directory
* @return void
*/
protected function makeDir($directory)
{
if (!$this->files->isDirectory($this->getPath($directory))) {
$this->info('Createing directory ' . $this->getPath($directory));
$this->files->makeDirectory($this->getPath($directory), 0777, true);
}
}
示例7: makeDir
/**
* Create dir if does not exists !
*
* @param $directory
* @return bool
*/
public function makeDir($directory)
{
if (!$this->filesystem->isDirectory($directory)) {
return $this->filesystem->makeDirectory($directory);
}
return false;
}
示例8: getModules
/**
* Modules of installed or not installed.
*
* @param bool $installed
*
* @return \Illuminate\Support\Collection
*/
public function getModules($installed = false)
{
if ($this->modules->isEmpty()) {
if ($this->files->isDirectory($this->getModulePath()) && !empty($directories = $this->files->directories($this->getModulePath()))) {
(new Collection($directories))->each(function ($directory) use($installed) {
if ($this->files->exists($file = $directory . DIRECTORY_SEPARATOR . 'composer.json')) {
$package = new Collection(json_decode($this->files->get($file), true));
if (Arr::get($package, 'type') == 'notadd-module' && ($name = Arr::get($package, 'name'))) {
$module = new Module($name);
$module->setAuthor(Arr::get($package, 'authors'));
$module->setDescription(Arr::get($package, 'description'));
if ($installed) {
$module->setInstalled($installed);
}
if ($entries = data_get($package, 'autoload.psr-4')) {
foreach ($entries as $namespace => $entry) {
$module->setEntry($namespace . 'ModuleServiceProvider');
}
}
$this->modules->put($directory, $module);
}
}
});
}
}
return $this->modules;
}
示例9: createMissingController
/**
* @param Request $request
* @return mixed
* @throws \Exception
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function createMissingController(Request $request)
{
$namespace = $request->namespace;
$controller = $request->controller;
$module = $request->module;
//Get controllers folder
$controllersDir = $this->getMainControllerPath();
//Get controller path for new controller
$newControllerDir = $this->getControllerPath($namespace, $module);
//Get controller namespace
$controllerNamespace = $this->getMainControllerNamespace();
//Get namespace for the new controller
$newControllerNamespace = $this->getControllerNamespace($namespace, $module);
//Get the file
$file = $this->getFileLocation($namespace, $module, $controller);
$controllerClass = studly_case($controller . 'Controller');
//Check if file exists
$fileExists = $this->fileExists($file);
//Check if is dir
if (!$this->fs->isDirectory($newControllerDir)) {
$this->fs->makeDirectory($newControllerDir, 0755, true, true);
}
//If file doesnt exist, create the file
if (!$fileExists) {
$template = $this->builder->setNamespace($newControllerNamespace)->setTemplate($this->fs->get($this->config['templates']['controller']))->setClassName(studly_case($controllerClass))->setUses(Request::class)->buildController();
//Store the file
$this->fs->put($file, $template);
//Call the created controller
return app($newControllerNamespace . '\\' . $controllerClass)->index();
}
throw new \Exception('File exists! I don\'t want to override it!');
}
示例10: makeDirectory
/**
* Create the directory for the controller.
*
* @param string $controller
* @param string $path
* @return void
*/
protected function makeDirectory($controller, $path)
{
$directory = $this->getDirectory($controller);
if (!$this->files->isDirectory($full = $path . '/' . $directory)) {
$this->files->makeDirectory($full, 0777, true);
}
}
示例11: save
public function save($item, $value, $environment, $group, $namespace = null)
{
$path = DIR_APPLICATION . '/config/generated_overrides';
if (!$this->files->exists($path)) {
$this->files->makeDirectory($path, 0777);
} elseif (!$this->files->isDirectory($path)) {
$this->files->delete($path);
$this->files->makeDirectory($path, 0777);
}
if ($namespace) {
$path = "{$path}/{$namespace}";
if (!$this->files->exists($path)) {
$this->files->makeDirectory($path, 0777);
} elseif (!$this->files->isDirectory($path)) {
$this->files->delete($path);
$this->files->makeDirectory($path, 0777);
}
}
$file = "{$path}/{$group}.php";
$current = array();
if ($this->files->exists($file)) {
$current = $this->files->getRequire($file);
}
array_set($current, $item, $value);
$renderer = new Renderer($current);
return $this->files->put($file, $renderer->render()) !== false;
}
示例12: makeDirectory
/**
* Build the directory for the view if necessary.
*
* @param $path
*/
private function makeDirectory($path)
{
$dir = dirname($path);
if (!$this->files->isDirectory($dir)) {
$this->files->makeDirectory($dir, 0777, true, true);
}
}
示例13: it_should_generate_module_folder
/** @test */
public function it_should_generate_module_folder()
{
// Run
$this->scaffoldModuleWithEloquent();
// Assert
$this->assertTrue($this->finder->isDirectory($this->testModulePath));
$this->cleanUp();
}
示例14: tearDown
public function tearDown()
{
$this->finder->deleteDirectory($this->modulePath);
if ($this->finder->isDirectory(base_path('modules/ModuleName'))) {
$this->finder->deleteDirectory(base_path('modules/ModuleName'));
}
parent::tearDown();
}
示例15: parse
/**
* Parse some content.
*
* @param $content
* @return string
*/
public function parse($content)
{
if (!$this->files->isDirectory($path = storage_path('framework/views/asset'))) {
$this->files->makeDirectory($path);
}
$this->files->put(storage_path('framework/views/asset/' . (($filename = md5($content)) . '.twig')), $content);
return $this->views->make('root::storage/framework/views/asset/' . $filename)->render();
}