@param string $directory

@return bool
541994
protected function codeStylePsr($directory = null)
    {
        $succeed = true;
        $config = ConfigUtils::getConfig('phpcs', array(
            'standard' => 'PSR2',
            'triggered_by' => 'php'
        ));

        if ($directory !== null && is_dir($directory)) {
            $processBuilder = new ProcessBuilder(
                array($config['triggered_by'], 'bin/phpcs', '--standard='.$config['standard'], $directory)
            );

            $processBuilder->setWorkingDirectory(getcwd());
            $phpCsFixer = $processBuilder->getProcess();
            $phpCsFixer->run(function ($type, $buffer) {
                $this->output->write($buffer);
            });

            if (!$phpCsFixer->isSuccessful()) {
                $this->output->writeln(sprintf('<error>%s</error>', trim($phpCsFixer->getOutput())));

                return false;
            }
        } else {
            foreach (GitUtils::commitedFiles() as $file) {
                $processBuilder = new ProcessBuilder(
                    array($config['triggered_by'], 'bin/phpcs', '--standard='.$config['standard'], $file)
                );

                $processBuilder->setWorkingDirectory(getcwd());
                $phpCsFixer = $processBuilder->getProcess();
                $phpCsFixer->run(function ($type, $buffer) {
                    $this->output->write($buffer);
                });

                if (!$phpCsFixer->isSuccessful()) {
                    $this->output->writeln(sprintf('<error>%s</error>', trim($phpCsFixer->getOutput())));
                    $succeed = false;
                }
            }
        }

        return $succeed;
    }
1357135
public function mkdir($directory, $recursive = false)
    {
        if (!$recursive or $this->isDir($directory)) {
            return $this->ftp->mkdir($directory);
        }

        $result = false;
        $pwd = $this->ftp->pwd();
        $parts = explode('/', $directory);

        foreach ($parts as $part) {
            if (!@$this->ftp->chdir($part)) {
                $result = $this->ftp->mkdir($part);
                $this->ftp->chdir($part);
            }
        }

        $this->ftp->chdir($pwd);

        return $result;
    }
419081
public function mkdir($directory = null)
    {
        if (\ftp_mkdir($this->_stream, $directory)) {
            return true;
        }

        $this->error = 'Failed to create directory "'.$directory.'"';

        return false;
    }
458866
public function copy($directory) {

		if(false === is_string($directory)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($directory)), E_USER_ERROR);
		}

		if(false === is_dir($directory)) {
			return trigger_error(sprintf('Directory "%s" passed to %s() is not an existing directory', $directory, __METHOD__), E_USER_ERROR);
		}

		if(false === is_writable($directory)) {
			return trigger_error(sprintf('Directory "%s" passed to %s() is not writable', $directory, __METHOD__), E_USER_ERROR);
		}

		if(false !== $this -> file -> getExists()) {

			//Add directory seperator to directory
			$directory = rtrim($directory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

			copy($this -> file -> getBasepath(), $directory . $this -> file -> getBasename());
		}

		return $this;
	}
1327298
public function files($directory)
	{
		$glob = glob($directory.'/*');

		if ($glob === false) return array();

		// To get the appropriate files, we'll simply glob the directory and filter
		// out any "files" that are not truly files so we do not end up with any
		// directories in our list, but only true files within the directory.
		return array_filter($glob, function($file)
		{
			return filetype($file) == 'file';
		});
	}
675345
protected function makeDir($directory)
    {
        if (!$this->filesystem->isDirectory($directory)) {
            $this->filesystem->makeDirectory($directory, 0777, true);
        }
    }
397585
static public function
	MakeDirectory($dir) {
	/*//
	@argv string Directory
	@return bool

	make a directory. returns if successful or not. allows you to
	blindly call it if it already exists to ensure it exists.
	//*/

		// if it already exists...
		if(is_dir($dir)) return true;

		// make it...
		$umask = umask(0);
		@mkdir($dir,0777,true);
		umask($umask);

		// find out if it was successful, lol.
		return is_dir($dir);
	}
757298
public function isExtension($directory)
    {
        $returnValue = (bool) false;

        
        $hasStructure = $this->findStructureManifest($directory) !== false;
        $hasPHPManifest = false;
        
        $files = scandir($this->options['input']);
        if ($files !== false) {
        	foreach ($files as $f) {
				if (is_file($this->options['input'] . '/' .$f) && is_readable($this->options['input'] . '/' . $f)) {
					if ($f == 'manifest.php') {
						$hasPHPManifest = true;
					}
				}
        	}
        }
        
        $returnValue = $hasStructure || $hasPHPManifest;
        

        return (bool) $returnValue;
    }
650044
public function deleteDirectories($directory)
    {
        $allDirectories = $this->directories($directory);

        if (! empty($allDirectories)) {
            foreach ($allDirectories as $directoryName) {
                $this->deleteDirectory($directoryName);
            }

            return true;
        }

        return false;
    }
438907
public function isDirectory($directory)
	{
		$directory = Util::normalizePath($directory);

		return (bool) $this->adapter->isDirectory($directory);
	}
462807
protected function makeDirs($directory)
	{
		foreach ($directory as $path) {
			if (!$this->files->isDirectory($this->getPath($path))){
				$this->files->makeDirectory($this->getPath($path), 0777, true);
			}
		}
	}
1239344
public function setDirectory($directory) {

		if(false === is_string($directory)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($directory)), E_USER_ERROR);
		}

		$this -> directory = new Directory($directory);

		if(false === $this -> directory -> isWritable()) {
			return trigger_error(sprintf('Directory "%s" passed to %s() is not writable', $directory, __METHOD__), E_USER_ERROR);
		}

		return $this;
	}
774806
public static function cleanDirectory(string $directory): bool
    {
        self::removeDirectory($directory);
        return self::createDirectory($directory);
    }
121616
public static function deleteFolder($dir)
    {
        $dh = @opendir($dir);
        if (!$dh) {
            return false;
        }
        while (false !== ($file = readdir($dh))) {
            if (($file != '.') && ($file != '..')) {
                $full = $dir . '/' . $file;
                if (is_dir($full)) {
                    self::deleteFolder($full);
                } else {
                    unlink($full);
                }
            }
        }
        closedir($dh);
        rmdir($dir);
        return true;
    }
1065498
public function mkdir(string $directory, int $mode = null): bool {
    if (!empty($directory)) {
      if ($folders = explode(DIRECTORY_SEPARATOR, Path::replaceOSSeparator($directory))) {
        $fullpath = null;
        if (empty($mode)) {
          $mode = AccessMode::MOD_0777;
        }
        foreach ($folders as $folder) {
          if (!empty($folder)) {
            $fullpath .= DIRECTORY_SEPARATOR . $folder;
            $this->createDirectory($fullpath, $mode);
          }
        }
      }
    }
    return file_exists($directory);
  }
57290
protected function purgeDir($directory)
	{
		if( ! $this->filesystem->isDirectory($directory))
			return true;

		if($this->filesystem->isWritable($directory))
			return $this->filesystem->cleanDirectory($directory);

		$this->error($directory . ' is not writable');

		return false;
	}
986180
public function rmdirRecursive($dir) {
		if (is_dir($dir)) {
			foreach (array_diff(scandir($dir), array('.', '..')) as $file) {
				@set_time_limit(30);
				$path = $dir . '/' . $file;
				(is_dir($path)) ? $this->rmdirRecursive($path) : @unlink($path);
			}
			return @rmdir($dir);
		} else if (is_file($dir)) {
			return @unlink($dir);
		}
		return false;
	}