src/Tasks/CopyrightHeader.php
protected function addHeader(\SplFileInfo $file, $text)
	{
		$content = file_get_contents($file->getRealPath());

		$lines = explode(PHP_EOL, $content);
		$text  = explode("\n", $text);

		foreach ($lines as $i => $l)
		{
			$l = trim($l);

			if (strpos($l, "<?php") === 0)
			{
				continue;
			}

			array_splice($lines, $i, 0, $text);

			break;
		}

		file_put_contents($file->getRealPath(), implode(PHP_EOL, $lines));
	}
protected function addHeader(\SplFileInfo $file, $text)
	{
		$content = file_get_contents($file->getRealPath());

		$lines = explode(PHP_EOL, $content);
		$text  = explode("\n", $text);

		foreach ($lines as $i => $l)
		{
			$l = trim($l);

			if (strpos($l, "<?php") === 0)
			{
				continue;
			}

			array_splice($lines, $i, 0, $text);

			break;
		}

		file_put_contents($file->getRealPath(), implode(PHP_EOL, $lines));
	}
protected function addHeader ( \ SplFileInfo $ file , $ text ) { $ content = file_get_contents ( $ file -> getRealPath ( ) ) ; $ lines = explode ( PHP_EOL , $ content ) ; $ text = explode ( "\n" , $ text ) ; foreach ( $ lines as $ i => $ l ) { $ l = trim ( $ l ) ; if ( strpos ( $ l , "<?php" ) === 0 ) { continue ; } array_splice ( $ lines , $ i , 0 , $ text ) ; break ; } file_put_contents ( $ file -> getRealPath ( ) , implode ( PHP_EOL , $ lines ) ) ; }
Adds copyright headers in file

@param   \SplFileInfo $file - Target

@return  void

@since   1.0
Adds copyright headers in file