Check out a branch.

@param string      $name
@param string|null $dir
The path to a Git repository.
@param bool        $mustRun
Enable exceptions if the Git command fails.
@param bool        $quiet

@return bool
488905
public function checkOut($name, $dir = null, $mustRun = false, $quiet = false)
    {
        return (bool) $this->execute([
            'checkout',
            $name,
        ], $dir, $mustRun, $quiet);
    }
1272962
public function add($name,$dir){
		if ($dir === false)
			$this->request->set_sort($name);
		else
			$this->request->set_sort($name,$dir);
	}
54308
protected function joinPathCE($dir, $name) {
		return (!$this->encoding)? $this->_joinPath($dir, $name) : $this->convEncOut($this->_joinPath($this->convEncIn($dir), $this->convEncIn($name)));
	}
468648
public function move($directory, $name = null)
    {
        $this->dir($directory);

        $this->name($name);

        return $this;
    }
1191772
private function exists_master_branch() {

		$ret = true;
		
		// デプロイ先のマスタブランチが無い場合はfalseを返す
		if ( !file_exists( $this->options->git->repository ) ) {
			$ret = false;
		}

		return $ret;

	}
181124
public function getAction($name, $need = TRUE)
    {
        return $this->hasActions()
            ? $this->getComponent(Action::ID)->getComponent($name, $need)
            : NULL;
    }
114278
public function run($name, AnCommandContext $context)
    {
        if ($this->_enabled) {
            $this->getStack()->push(clone $this);

            foreach ($this->getStack()->top() as $command) {
                if ($command->execute($name, $context) === $this->_break_condition) {
                    $this->getStack()->pop();
                    return $this->_break_condition;
                }
            }

            $this->getStack()->pop();
        }
    }
1031591
public function scanDir($dir_name, $filter = array('.cvs', '.svn', '.git'))
    {
        if (!is_dir($dir_name)) {
            throw  new InvalidArgumentException("Dir [{$dir_name}] is not found.");
        }

        $dir_name = rtrim($dir_name, '/').'/';

        $handle = opendir($dir_name);

        static $files = array();
        while (false !== ($file = readdir($handle))) {
            if ($file == '.' || $file == '..' || in_array($file, $filter)) {
                continue;
            }
            if (is_dir($dir_name.$file)) {
                $this->scanDir($dir_name.$file, $filter);
            } else {
                $files[] = $dir_name.$file;
            }
        }

        closedir($handle);

        return $files;
    }
1290032
public function scan_dir_namespace_class( $dir, $split = false, $relative = '' ) {
		$dir  = rtrim( $dir, DS );
		$list = [];
		if ( is_dir( $dir ) ) {
			foreach ( scandir( $dir ) as $file ) {
				if ( $file === '.' || $file === '..' || $file === 'base.php' ) {
					continue;
				}

				$path = rtrim( $dir, DS ) . DS . $file;
				if ( is_file( $path ) ) {
					if ( $this->ends_with( $file, '.php' ) ) {
						if ( $split ) {
							$list[] = [ $relative, ucfirst( $this->app->get_page_slug( $file ) ) ];
						} else {
							$list[] = $relative . ucfirst( $this->app->get_page_slug( $file ) );
						}
					}
				} elseif ( is_dir( $path ) ) {
					$list = array_merge( $list, $this->scan_dir_namespace_class( $path, $split, $relative . ucfirst( $file ) . '\\' ) );
				}
			}
		}

		return $list;
	}
901124
public function readDir($dir_name, $filter = array('.cvs', '.svn', '.git'))
    {
        if (!is_dir($dir_name)) {
            throw  new InvalidArgumentException("Dir [{$dir_name}] is not found.");
        }

        $handle = opendir($dir_name);

        $files = array();
        while (false !== ($file = readdir($handle))) {
            if ($file == '.' || $file == '..' || in_array($file, $filter)) {
                continue;
            }
            $files[] = $file;
        }

        closedir($handle);

        return $files;
    }
438658
public function fileExists($name, $dir = null)
    {
//        $this->dump($name . ':' . $dir);
        $reflection = new \ReflectionClass(get_class($this));
        if(($themeBundle = $this->getParam("themeBundle", 'eDemyMainBundle', "eDemyThemeBundle")) !== 'themeBundle') {
            $dir = $this->getBundlePath($themeBundle, true) . '/Resources/views/' . $dir;
        }
        // Si se está ejecutando desde la caché
        if(strpos($reflection->getFileName(), '/cache/')) {
            // subimos hasta el directorio raíz de la aplicación (3 niveles)
            $basedir = dirname($reflection->getFileName()) . '/../../..';
        } else {
            // si no subimos 6 niveles hasta el directorio raíz de la aplicación
            $basedir = dirname($reflection->getFileName()) . '/../../../../../..';
        }
        $fs = new Filesystem();
        //die(var_dump($basedir . $dir . $name));
        //if($fs->exists($basedir . $dir . $name)) {
        if($fs->exists($dir . $name)) {

            return true;
        }

        return false;
    }
642340
private function _createFile($dir, $name, $ext)
    {
        if (!empty($this->rootDir)) {
            if (!file_exists($this->_getFileDir($dir))) {
                mkdir($this->_getFileDir($dir), 0777, true);
            }
            if (!file_exists($this->_getFilePath($dir, $name, $ext))) {
                if (file_put_contents($this->_getFilePath($dir, $name, $ext), '') === false) {
                    throw new \Exception("Could not create $ext for {$this->username}.");
                }
            }
        }
    }
250412
public static function checkCache(&$config, $silent = false) {
		$dirs = self::getCacheDirectories ( $config, $silent );
		foreach ( $dirs as $dir ) {
			self::safeMkdir ( $dir );
		}
		return $dirs;
	}
1272103
public function hasRole($name, $requireAll = false)
    {
        if (is_array($name)) {
            foreach ($name as $roleName) {
                $hasRole = $this->hasRole($roleName);

                if ($hasRole && !$requireAll) {
                    return true;
                } elseif (!$hasRole && $requireAll) {
                    return false;
                }
            }

            // If we've made it this far and $requireAll is FALSE, then NONE of the roles were found
            // If we've made it this far and $requireAll is TRUE, then ALL of the roles were found.
            // Return the value of $requireAll;
            return $requireAll;
        } else {
            foreach ($this->cachedRoles() as $role) {
                if ($role->name == $name) {
                    return true;
                }
            }
        }

        return false;
    }
728685
protected function doFilterDir($name /*, $dir*/)
    {
        if (\in_array($name, $this->include['dir'], true)) {
            // have bee set custom dir Filter
            if ($dirFilter = $this->dirFilter) {
                return $dirFilter($name);
            }

            return true;
        }

        if (\in_array($name, $this->exclude['dir'], true)) {
            return false;
        }

        // have bee set custom dir Filter
        if ($dirFilter = $this->dirFilter) {
            return $dirFilter($name);
        }

        // use default filter handle
        return true;
    }
458161
protected function getGitRemoteUrl($dir)
    {
        $this->git->ensureInstalled();
        foreach ([$this->config->get('detection.git_remote_name'), 'origin'] as $remote) {
            if ($url = $this->git->getConfig("remote.$remote.url", $dir)) {
                return $url;
            }
        }

        return false;
    }
150518
public static void doWithStopwatch(String name, Runnable runnable) {
		try (Split split = SimonManager.getStopwatch(name).start()) {
			runnable.run();
		}
	}