PHP Classes

File: bin/peol

Recommend this page to a friend!
  Classes of Michael Cummings   PHP EOL Conversion   bin/peol   Download  
File: bin/peol
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP EOL Conversion
Convert the end of line characters of given files
Author: By
Last change:
Date: 7 years ago
Size: 2,275 bytes
 

Contents

Class file image Download
#!/usr/bin/env php
<?php
/**
 * Contains PhpEOL cli console.
 *
 * PHP version 5.3
 *
 * LICENSE:
 * This file is part of PhpEOL which is a simple Non-OS specific PHP script to
 * change line endings on a group of files.
 * Copyright (C) 2014 Michael Cummings
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
 * Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License along with this program. If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * You should be able to find a copy of this license in the LICENSE.md file. A copy of the GNU GPL should also be
 * available in the GNU-GPL.md file.
 *
 * @copyright 2014 Michael Cummings
 * @license http://www.gnu.org/copyleft/lesser.html GNU LGPL
 * @author Michael Cummings <mgcummings@yahoo.com>
 */
namespace peol;

/*
 * Find auto loader from one of
 * vendor/bin/
 * OR ./
 * OR bin/
 * OR lib/PhpEOL/
 * OR vendor/PhpEOL/PhpEOL/bin/
 */
(@include_once dirname(__DIR__) . '/autoload.php')
|| (@include_once
__DIR__ . '/vendor/autoload.php')
|| (@include_once
dirname(__DIR__) . '/vendor/autoload.php')
|| (@include_once
dirname(dirname(__DIR__)) . '/vendor/autoload.php')
|| (@include_once
dirname(dirname(dirname(__DIR__))) . '/autoload.php')
|| die(
'Could not find required auto class loader. Aborting ...');
use
peol\Command\ToOldMacCommand;
use
peol\Command\ToUnixCommand;
use
peol\Command\ToWinCommand;
use
peol\Converter\Converter;
use
Symfony\Component\Console\Application;

$cwd = getcwd();
$converter = new Converter();
$application = new Application('Php End Of Line (peol) Converter', '0.0.1');
$application->add(new ToUnixCommand('EolToUnix', $cwd, $converter));
$application->add(new ToWinCommand('EolToWin', $cwd, $converter));
$application->add(new ToOldMacCommand('EolToOldMac', $cwd, $converter));
$application->run();