Evaluate the rule and its test

@param array $ini Current php.ini configuration
@throws \InvalidArgumentException
@return null
556574
public function evaluate(array $ini)
	{
		$test = $this->getTest();
		$evalClass = "\\Psecio\\Iniscan\\Operation\\Operation".ucwords(strtolower($test->operation));

		if (!class_exists($evalClass)) {
			throw new \InvalidArgumentException('Invalid operation "'.$test->operation.'"');
		}
		$value = (isset($test->value)) ? $test->value : null;
		$this->setValue($value);

		$evalInstance = new $evalClass($this->getSection());

		if (isset($test->version) && !$this->isVersion($test->version)) {
			$this->na();
		} else {
			($evalInstance->execute($test->key, $value, $ini) === false)
				? $this->fail() : $this->pass();
		}
	}
1253399
public function parse(array $argv = null)
    {
        $cliArguments = $this->arguments($argv);

        if (in_array('--', $cliArguments)) {
            $cliArguments = $this->removeTrailingArguments($cliArguments);
        }

        $unParsedArguments = $this->prefixedArguments($cliArguments);

        $this->nonPrefixedArguments($unParsedArguments);

        // After parsing find out which arguments were required but not
        // defined on the command line.
        $missingArguments = $this->filter->missing();

        if (count($missingArguments) > 0) {
            throw new InvalidArgumentException(
                'The following arguments are required: '
                . $this->summary->short($missingArguments) . '.'
            );
        }
    }
1109537
public static function set_Inet( $inet )
    {
        if( $inet instanceof Inet ) {
            return $inet;
        }
        try {
            $inet = new Inet( $inet );
            return $inet;
        } catch ( \InvalidArgumentException $e ) {
            return null;
        }
    }
940445
public static function phpini()
    {
        if (!self::isDebug()) {
            return false;
        }

        $data = get_cfg_var('cfg_file_path');
        if (!@file($data)) {
            return false;
        }
        $ini = parse_ini_file($data, true);
        return self::i()->dump($ini, '! php.ini !');
    }
1005094
private function validate(MethodInvocation $invocation, \ReflectionMethod $onValidate, \ReflectionMethod $onFailure = null)
    {
        $validation = $onValidate->invokeArgs($invocation->getThis(), (array) $invocation->getArguments());
        if ($validation instanceof Validation && $validation->getMessages()) {
            /* @var $validation Validation */
            $validation->setInvocation($invocation);
            $failure = $this->getFailure($invocation, $validation, $onFailure);
            if ($failure instanceof \Exception) {
                throw $failure;
            }

            return [false, $failure];
        }

        return [true, null];
    }
506393
protected function checkConfiguration()
    {
        if (
            empty($this->config['name'])
            || empty($this->config['username'])
            || empty($this->config['host'])
        ) {
            throw new InvalidArgumentException(static::E_CONFIG);
        }
    }
761857
public function check()
    {
        $returnValue = null;

        
        $validity = null;
        $name = $this->getName();
        if (($value = ini_get($name)) !== false){
            // The ini value exists for this name.
            if ((($value == '') ? '0' : $value) == $this->getExpectedValue()){
                $validity = common_configuration_Report::VALID;
                $message = "PHP Configuration Option '${name}' = '${value}' has an expected value.";
            }
            else {
                $validity = common_configuration_Report::INVALID;
                $message = "PHP Configuration Option '${name}' = '${value}' has an unexpected value.";
            }
        }
        else {
            // Unknown ini value name.
            $validity = common_configuration_Report::UNKNOWN;
            $message = "PHP Configuration Option '${name}' is unknown.";
        }

        $returnValue = new common_configuration_Report($validity, $message, $this);
        

        return $returnValue;
    }
221302
protected function initialize(InputInterface $input, OutputInterface $output)
    {

        parent::initialize($input, $output);

        $translationMode = $input->getOption('mode');
        $validModes      = array(
            'reviewed',
            'translated',
            'default'
        );
        if (!in_array($translationMode, $validModes)) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Invalid translation mode %s specified. Must be one of %s',
                    $translationMode,
                    implode(', ', $validModes)
                )
            );
        }
    }
262988
public function findOneBy(array $criteria): ?ResourceInterface
    {
        if (empty($criteria)) {
            throw new \InvalidArgumentException('The criteria array needs to be set.');
        }

        $results = $this->applyCriteria($this->findAll(), $criteria);

        if ($result = reset($results)) {
            return $result;
        }

        return null;
    }
767927
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path = $input->getOption('path');

        // 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.'"');
        }
        $ini = parse_ini_file($path, true);

        $output->writeLn('Current PHP.ini settings from '.$path);
        $output->writeLn('##########');

        foreach ($ini as $section => $data) {
            $output->writeLn('<info>:: '.$section.'</info>');
            if (empty($data)) {
                $output->writeLn("\t<fg=yellow>No settings</fg=yellow>");
            } else {
                foreach ($data as $path => $value) {
                    $output->writeLn("\t".$path.' => '.var_export($value, true));
                }
            }
            $output->writeLn("-----------------\n");
        }

    }
299331
public static function init(array $initArgs = array())
    {
        if (!self::$_initiated) {
            if (!defined('XIPHE_HTML_BASE_FOLDER')) {
                define('XIPHE_HTML_BASE_FOLDER', dirname(__DIR__).DIRECTORY_SEPARATOR);
            }

            foreach (self::getThemasterSettings() as $key => $s) {
                if (is_array($s) && isset($s['default'])) {
                    self::$_defaults[$key] = $s['default'];
                }
            }

            /*
             * Get the config array from config.php
             */
            $config = array();
            if (file_exists(XIPHE_HTML_BASE_FOLDER.'config.php')) {
                call_user_func(
                    function () use (&$config) {
                        include XIPHE_HTML_BASE_FOLDER.'config.php';
                    }
                );
            } elseif(!file_exists(XIPHE_HTML_BASE_FOLDER.'config-sample.php')) {
                self::_createSampleConfig();
            }

            /*
             * Make sure config is an array.
             */
            if (!is_array($config)) {
                Generator::debug('$config is not an array.', 3, 7);
                $config = array();
            }

            /*
             * Merge it into the defaults
             */
            $defaults = array_merge(self::$_defaults, $config);

            /*
             * Remove invalid keys and merge the initArgs.
             */
            foreach (self::$_defaults as $k => $v) {
                self::$_config[$k] = (isset($initArgs[$k]) ? $initArgs[$k] : $defaults[$k]);
            }

            self::$_initiated = true;
        }
    }
76410
static function createFromINI( $iniGroup, $iniFilename = false )
    {
        if ( !$iniFilename )
            $iniFilename = 'image.ini';

        $handler = false;
        $ini = eZINI::instance( $iniFilename );
        if ( !$ini )
        {
            eZDebug::writeError( "Failed loading ini file $iniFilename", __METHOD__ );
            return $handler;
        }

        if ( $ini->hasGroup( $iniGroup ) )
        {
            $name = $iniGroup;
            if ( $ini->hasVariable( $iniGroup, 'Name' ) )
                $name = $ini->variable( $iniGroup, 'Name' );
            $conversionRules = false;
            if ( $ini->hasVariable( $iniGroup, 'ConversionRules' ) )
            {
                $conversionRules = array();
                $rules = $ini->variable( $iniGroup, 'ConversionRules' );
                foreach ( $rules as $ruleString )
                {
                    $ruleItems = explode( ';', $ruleString );
                    if ( count( $ruleItems ) >= 2 )
                    {
                        $conversionRules[] = array( 'from' => $ruleItems[0],
                                                    'to' => $ruleItems[1] );
                    }
                }
            }
            $isEnabled = $ini->variable( $iniGroup, 'IsEnabled' ) == 'true';
            $outputRewriteType = self::REPLACE_SUFFIX;
            $handler = new eZImageGDHandler( $name, $isEnabled,
                                             $outputRewriteType,
                                             $conversionRules );
            return $handler;
        }
        return $handler;
    }
376087
public static function init($configPath = null)
    {
        if (!$configPath) {
            return new self();
        }
        if (!isset(self::$instances[$configPath])) {
            if (!file_exists($configPath) || !is_readable($configPath)) {
                throw new \InvalidArgumentException("Invalid config path '$configPath'");
            }
            self::$instances[$configPath] = new static(parse_ini_file($configPath, true));
        }

        return self::$instances[$configPath];
    }
1206313
public function init($args = null){
		/*
		echo __METHOD__.__LINE__.'<br>'.PHP_EOL;
		echo __METHOD__.__LINE__.'get_class<pre>['.var_export(get_class($this), true).']</pre>'.'<br>'.PHP_EOL; 
		echo __METHOD__.__LINE__.'get_parent_class<pre>['.var_export(get_parent_class(__CLASS__), true).']</pre>'.'<br>'.PHP_EOL; 
		echo __METHOD__.__LINE__.'<br>'.PHP_EOL;
		echo __METHOD__.__LINE__.'get_class_methods<pre>['.var_export(get_class_methods($this), true).']</pre>'.'<br>'.PHP_EOL; 
		*/
		#parent::__construct($this->logConfig);
		
		$this->logConfig = $GLOBALS["CONFIG_MANAGER"]->getSetting('AUTH','AUDIT','CLIENT_LOG');
		
		parent::__construct($args);
		return;
	}
227258
private function _validateIv($iv = null)
    {
        if (self::$allowedCiphers[$this->cipher]['iv']) {
            $this->blockSize = openssl_cipher_iv_length($this->cipher);

            $ivLength = mb_strlen($iv, '8bit');
            if ($ivLength !== $this->blockSize) {
                throw new InvalidArgumentException(sprintf(
                    'Initialization vector of %d bytes is required for cipher "%s", %d given.',
                    $this->blockSize,
                    $this->cipher,
                    $ivLength
                ));
            }
        }
    }
50683
private function _parseIni($iniFile)
    {
        $aParsedIni = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
        $tmpArray = array();
        foreach ($aParsedIni as $key=>$value) {
            if (strpos($key, ':') !== false) {
                $sections = explode(':', $key);
                if (count($sections) != 2) {
                    throw new Exception('Malformed section header!');
                }
                $currentSection = trim($sections[0]);
                $parentSection = trim($sections[1]);
                $value = array_merge_recursive(
                    $aParsedIni[$parentSection],
                    $aParsedIni[$key]
                );
                $aParsedIni[$currentSection] = $value;
                unset($aParsedIni[$key]);
                $key = $currentSection;
            }
            if (is_array($value)) {
                foreach ($value as $vk=>$vv) {
                    $newKey = $key.".".$vk;
                    $tmpArray[$newKey] = $vv;
                    if (
                           is_string($vv) &&
                           preg_match_all('/\${([a-zA-Z0-9\.]+)}/', $vv, $match)
                        ) {
                        if (!isset($match[1])) {
                            continue;
                        }
                        $variableKey = $match[1];
                        foreach ($variableKey as &$var) {
                            if (strpos($var, '.') === false) {
                                $var = $key . '.' . $var;
                            }
                        }
                        $this->_varDeps[$newKey] = $variableKey;
                    }
                }
            }
        }
        if (!empty($tmpArray)) {
            $aParsedIni = $tmpArray;
        }
        foreach ($aParsedIni as $key=>$value) {    //extract parsed array keys
            if (array_key_exists($key, $this->_varDeps)) {
                $deps = &$this->_varDeps;
                $value = preg_replace_callback(
                    '/\${([a-zA-Z0-9\.]+)}/',
                    function ($match) use ($key, $aParsedIni, &$deps) {
                        return $aParsedIni[array_shift($deps[$key])];
                    },
                    $value
                );
                $aParsedIni[$key] = $value;
            }
            $this->_tmpValue = $value;//set temporay value to current ini value
            $aXKey = explode($this->_delimiter, $key);    //get ini key segments
            //set object properties recursively based on parsed ini
            $this->_recursiveInit($this->_obj, $aXKey);
        }
    }
314144
protected function evaluateFile(array $ini)
	{
		$savePath = $this->findValue('session.save_path', $ini);

		if ($savePath === '/tmp') {
			$this->setDescription('Custom path not set, default (/tmp) is world writeable');
			$this->fail();
			return false;
		}

		if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
			$this->na();
			$this->setDescription('Cannot check Windows permissions. Please verify them manually');
			return true;
		}

		$perms = substr(sprintf('%o', fileperms($savePath)), - 3);
		if ($perms == 777) {
			$this->fail();
			$this->setDescription('Path '.$savePath.' is world writeable');
			return false;
		} else {
			$this->pass();
			return true;
		}
	}