src/Shell/SuperfluousWhitespaceShell.php
public function eof() {
		if (!empty($this->args[0])) {
			$folder = realpath($this->args[0]);
		} else {
			$folder = APP;
		}
		$App = new Folder($folder);
		$this->out('Checking *.php in ' . $folder);

		$files = $App->findRecursive('.*\.php');

		$this->out('Found ' . count($files) . ' files.');

		$action = $this->in('Continue? [y]/[n]', ['y', 'n'], 'n');
		if ($action !== 'y') {
			$this->abort('Aborted');
		}

		foreach ($files as $file) {
			$this->out('Processing ' . $file, 1, Shell::VERBOSE);
			$content = $store = file_get_contents($file);
			$content = trim($content);
			$ext = pathinfo($file, PATHINFO_EXTENSION);
			if ($ext === 'php' && substr($content, -2, 2) === '?>') {
				$content = substr($content, 0, -2);
			}

			$x = substr_count($content, "\r\n");
			if ($x > 0) {
				$newline = "\r\n";
			} else {
				$newline = "\n";
			}

			// add one new line at the end
			$content = trim($content) . $newline;
			if ($content !== $store) {
				file_put_contents($file, $content);
			}
		}
		$this->out('Done');
	}
public function eof() {
		if (!empty($this->args[0])) {
			$folder = realpath($this->args[0]);
		} else {
			$folder = APP;
		}
		$App = new Folder($folder);
		$this->out('Checking *.php in ' . $folder);

		$files = $App->findRecursive('.*\.php');

		$this->out('Found ' . count($files) . ' files.');

		$action = $this->in('Continue? [y]/[n]', ['y', 'n'], 'n');
		if ($action !== 'y') {
			$this->abort('Aborted');
		}

		foreach ($files as $file) {
			$this->out('Processing ' . $file, 1, Shell::VERBOSE);
			$content = $store = file_get_contents($file);
			$content = trim($content);
			$ext = pathinfo($file, PATHINFO_EXTENSION);
			if ($ext === 'php' && substr($content, -2, 2) === '?>') {
				$content = substr($content, 0, -2);
			}

			$x = substr_count($content, "\r\n");
			if ($x > 0) {
				$newline = "\r\n";
			} else {
				$newline = "\n";
			}

			// add one new line at the end
			$content = trim($content) . $newline;
			if ($content !== $store) {
				file_put_contents($file, $content);
			}
		}
		$this->out('Done');
	}
public function eof ( ) { if ( ! empty ( $ this -> args [ 0 ] ) ) { $ folder = realpath ( $ this -> args [ 0 ] ) ; } else { $ folder = APP ; } $ App = new Folder ( $ folder ) ; $ this -> out ( 'Checking *.php in ' . $ folder ) ; $ files = $ App -> findRecursive ( '.*\.php' ) ; $ this -> out ( 'Found ' . count ( $ files ) . ' files.' ) ; $ action = $ this -> in ( 'Continue? [y]/[n]' , [ 'y' , 'n' ] , 'n' ) ; if ( $ action !== 'y' ) { $ this -> abort ( 'Aborted' ) ; } foreach ( $ files as $ file ) { $ this -> out ( 'Processing ' . $ file , 1 , Shell :: VERBOSE ) ; $ content = $ store = file_get_contents ( $ file ) ; $ content = trim ( $ content ) ; $ ext = pathinfo ( $ file , PATHINFO_EXTENSION ) ; if ( $ ext === 'php' && substr ( $ content , - 2 , 2 ) === '?>' ) { $ content = substr ( $ content , 0 , - 2 ) ; } $ x = substr_count ( $ content , "\r\n" ) ; if ( $ x > 0 ) { $ newline = "\r\n" ; } else { $ newline = "\n" ; } // add one new line at the end $ content = trim ( $ content ) . $ newline ; if ( $ content !== $ store ) { file_put_contents ( $ file , $ content ) ; } } $ this -> out ( 'Done' ) ; }
Whitespaces at the end of the file
If PHP file with trailing ?> that will be removed as per coding standards.

@return void
Whitespaces at the end of the file If PHP file with trailing ? > that will be removed as per coding standards .