src/Psecio/Iniscan/Command/FixCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getOption('path');
        $context = array();

        // if we're not given a path at all, try to figure it out
        if ($path === null) {
            $path = php_ini_loaded_file();
        }

        if (!is_file($path)) {
            throw new \Exception('Path is null or not accessible: "'.$path.'"');
        }

        $scan = new \Psecio\Iniscan\Scan($path, $context);
        $scan->execute();

        $scan->getMarked();
        $result = pathinfo($path);

        // to start, we need a backup of the file (overwrite if there)
        $backupPath = './'.$result['basename'].'-'.date('mdy');
        copy($path, $backupPath);

        // Now les get our rules and parse them
        $scan = new \Psecio\Iniscan\Scan($path, $context);
        $rules = get_object_vars($scan->getRules());

        $output->writeLn($this->generateIniOutput($rules));
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getOption('path');
        $context = array();

        // if we're not given a path at all, try to figure it out
        if ($path === null) {
            $path = php_ini_loaded_file();
        }

        if (!is_file($path)) {
            throw new \Exception('Path is null or not accessible: "'.$path.'"');
        }

        $scan = new \Psecio\Iniscan\Scan($path, $context);
        $scan->execute();

        $scan->getMarked();
        $result = pathinfo($path);

        // to start, we need a backup of the file (overwrite if there)
        $backupPath = './'.$result['basename'].'-'.date('mdy');
        copy($path, $backupPath);

        // Now les get our rules and parse them
        $scan = new \Psecio\Iniscan\Scan($path, $context);
        $rules = get_object_vars($scan->getRules());

        $output->writeLn($this->generateIniOutput($rules));
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ path = $ input -> getOption ( 'path' ) ; $ context = array ( ) ; // if we're not given a path at all, try to figure it out if ( $ path === null ) { $ path = php_ini_loaded_file ( ) ; } if ( ! is_file ( $ path ) ) { throw new \ Exception ( 'Path is null or not accessible: "' . $ path . '"' ) ; } $ scan = new \ Psecio \ Iniscan \ Scan ( $ path , $ context ) ; $ scan -> execute ( ) ; $ scan -> getMarked ( ) ; $ result = pathinfo ( $ path ) ; // to start, we need a backup of the file (overwrite if there) $ backupPath = './' . $ result [ 'basename' ] . '-' . date ( 'mdy' ) ; copy ( $ path , $ backupPath ) ; // Now les get our rules and parse them $ scan = new \ Psecio \ Iniscan \ Scan ( $ path , $ context ) ; $ rules = get_object_vars ( $ scan -> getRules ( ) ) ; $ output -> writeLn ( $ this -> generateIniOutput ( $ rules ) ) ; }
Execute the "fix" command

@param  InputInterface $input Input object
@param  OutputInterface $output Output object
@throws \Exception
@return null
Execute the fix command