src/Shell/IndentShell.php
public function folder() {
		if (!empty($this->params['extensions'])) {
			$this->settings['files'] = Text::tokenize($this->params['extensions']);
		}
		if (!empty($this->params['again'])) {
			$this->settings['againWithHalf'] = true;
		}

		$folder = null;
		if (!empty($this->args)) {
			if (!empty($this->args[0]) && $this->args[0] !== 'app') {
				$folder = $this->args[0];
				if ($folder === '/') {
					$folder = APP;
				}

				$folder = realpath($folder);
				if (!file_exists($folder)) {
					$this->abort('folder not exists: ' . $folder . '');
				}
				$this->_paths[] = $folder;
			} elseif ($this->args[0] === 'app') {
				$this->_paths[] = APP;
			}

			if (!empty($this->params['files'])) {
				$this->settings['files'] = explode(',', $this->params['files']);
			}

			$this->out($folder);
			$this->out('searching...');
			$this->_searchFiles();

			$this->out('found: ' . count($this->_files));
			if (empty($this->params['dry-run'])) {
				if (!$this->params['force']) {
					$continue = $this->in('Modifying files! Continue?', ['y', 'n'], 'n');
					if (mb_strtolower($continue) !== 'y' && mb_strtolower($continue) !== 'yes') {
						$this->abort('...aborted');
					}
				}

				$this->_correctFiles();
				$this->out('DONE');
			}

		} else {
			$this->out('Usage: cake intend folder');
			$this->out('"folder" is then intended recursivly');
			$this->out('default file types are');
			$this->out('[' . implode(', ', $this->settings['files']) . ']');

			$this->out('');
			$this->out('Specify file types manually:');
			$this->out('-files php,js,css');
		}
	}
public function folder() {
		if (!empty($this->params['extensions'])) {
			$this->settings['files'] = Text::tokenize($this->params['extensions']);
		}
		if (!empty($this->params['again'])) {
			$this->settings['againWithHalf'] = true;
		}

		$folder = null;
		if (!empty($this->args)) {
			if (!empty($this->args[0]) && $this->args[0] !== 'app') {
				$folder = $this->args[0];
				if ($folder === '/') {
					$folder = APP;
				}

				$folder = realpath($folder);
				if (!file_exists($folder)) {
					$this->abort('folder not exists: ' . $folder . '');
				}
				$this->_paths[] = $folder;
			} elseif ($this->args[0] === 'app') {
				$this->_paths[] = APP;
			}

			if (!empty($this->params['files'])) {
				$this->settings['files'] = explode(',', $this->params['files']);
			}

			$this->out($folder);
			$this->out('searching...');
			$this->_searchFiles();

			$this->out('found: ' . count($this->_files));
			if (empty($this->params['dry-run'])) {
				if (!$this->params['force']) {
					$continue = $this->in('Modifying files! Continue?', ['y', 'n'], 'n');
					if (mb_strtolower($continue) !== 'y' && mb_strtolower($continue) !== 'yes') {
						$this->abort('...aborted');
					}
				}

				$this->_correctFiles();
				$this->out('DONE');
			}

		} else {
			$this->out('Usage: cake intend folder');
			$this->out('"folder" is then intended recursivly');
			$this->out('default file types are');
			$this->out('[' . implode(', ', $this->settings['files']) . ']');

			$this->out('');
			$this->out('Specify file types manually:');
			$this->out('-files php,js,css');
		}
	}
public function folder ( ) { if ( ! empty ( $ this -> params [ 'extensions' ] ) ) { $ this -> settings [ 'files' ] = Text :: tokenize ( $ this -> params [ 'extensions' ] ) ; } if ( ! empty ( $ this -> params [ 'again' ] ) ) { $ this -> settings [ 'againWithHalf' ] = true ; } $ folder = null ; if ( ! empty ( $ this -> args ) ) { if ( ! empty ( $ this -> args [ 0 ] ) && $ this -> args [ 0 ] !== 'app' ) { $ folder = $ this -> args [ 0 ] ; if ( $ folder === '/' ) { $ folder = APP ; } $ folder = realpath ( $ folder ) ; if ( ! file_exists ( $ folder ) ) { $ this -> abort ( 'folder not exists: ' . $ folder . '' ) ; } $ this -> _paths [ ] = $ folder ; } elseif ( $ this -> args [ 0 ] === 'app' ) { $ this -> _paths [ ] = APP ; } if ( ! empty ( $ this -> params [ 'files' ] ) ) { $ this -> settings [ 'files' ] = explode ( ',' , $ this -> params [ 'files' ] ) ; } $ this -> out ( $ folder ) ; $ this -> out ( 'searching...' ) ; $ this -> _searchFiles ( ) ; $ this -> out ( 'found: ' . count ( $ this -> _files ) ) ; if ( empty ( $ this -> params [ 'dry-run' ] ) ) { if ( ! $ this -> params [ 'force' ] ) { $ continue = $ this -> in ( 'Modifying files! Continue?' , [ 'y' , 'n' ] , 'n' ) ; if ( mb_strtolower ( $ continue ) !== 'y' && mb_strtolower ( $ continue ) !== 'yes' ) { $ this -> abort ( '...aborted' ) ; } } $ this -> _correctFiles ( ) ; $ this -> out ( 'DONE' ) ; } } else { $ this -> out ( 'Usage: cake intend folder' ) ; $ this -> out ( '"folder" is then intended recursivly' ) ; $ this -> out ( 'default file types are' ) ; $ this -> out ( '[' . implode ( ', ' , $ this -> settings [ 'files' ] ) . ']' ) ; $ this -> out ( '' ) ; $ this -> out ( 'Specify file types manually:' ) ; $ this -> out ( '-files php,js,css' ) ; } }
Main execution function to indent a folder recursivly

@return int|null
Main execution function to indent a folder recursivly