Process "null" type argument

@param  Element $arg
@return stdClass
@throws InvalidConfig
334991
protected function processArgumentNull(Element $arg) {
		$definition = new stdClass();
		
		$definition->type  = 'value';
		$definition->value = null;
		
		return $definition;
	}
216094
private function collection($args = null) {

        static $data = [];


        if(isset($args[1])) {
            
            if(preg_match('/(.*)\[(.*)\]/', $args[0], $matches)) {

                $data[$matches[1]][$matches[2]] = $args[1];

            } else {

                $data[$args[0]] = $args[1];

                return $args[1];
            }
        }

        return $data;
    }
865182
public function process($text, $args = null)
    {
        $text = $this->processDocuments($text, $args);
        $text = $this->processGalleries($text, $args);

        return $text;
    }
311244
protected function parseOptions(string $arg, string $nextArg = null): bool
    {
        $value = \substr($nextArg, 0, 1) === '-' ? null : $nextArg;

        if (null === $option  = $this->optionFor($arg)) {
            return $this->handleUnknown($arg, $value);
        }

        $this->_lastVariadic = $option->variadic() ? $option->attributeName() : null;

        return false === $this->emit($option->attributeName(), $value) ? false : $this->setValue($option, $value);
    }
916504
public function check(...$args)
    {
        if (count($args) !== count($this->constraints)) {
            throw new InvalidArgumentException(
                'Argument number mismatch.'
            );
        }

        foreach ($args as $key => $arg) {
            if (!$this->constraints[$key]->check($arg, $args)) {
                throw new InvalidArgumentException(vsprintf(
                    'Argument %s does not meet its constraints.'
                    . "\nFailed constraint: %s\nValue provided:%s",
                    [
                        $key,
                        $this->constraints[$key]->toString(),
                        print_r($arg, true)
                    ]
                ));
            }
        }
    }
864184
public function process($arguments = null)
    {
        if ($arguments === null) {
            $arguments = isset($_SERVER['argv']) ? array_slice($_SERVER['argv'], 1) : [];
            $arguments = new Arguments($arguments);
        } elseif (is_array($arguments)) {
            $arguments = new Arguments($arguments);
        } elseif (is_string($arguments)) {
            $arguments = Arguments::fromString($arguments);
        } elseif (!$arguments instanceof Arguments) {
            throw new \InvalidArgumentException(
                '$arguments has to be an instance of Arguments, an arguments string, an array of arguments or null'
            );
        }

        $setOption = function ($name, callable $getValue) {
            $option = $this->getOptionObject($name);

            if (!$option) {
                if (!$this->get(self::SETTING_STRICT_OPTIONS)) {
                    $value = $getValue() ?: 1;
                    if (isset($this->additionalOptions[$name]) &&
                        is_int($value) && is_int($this->additionalOptions[$name])
                    ) {
                        $value += $this->additionalOptions[$name];
                    }

                    $this->additionalOptions[$name] = $value;
                    return;
                } else {
                    throw new Unexpected(sprintf(self::translate('option-unknown'), $name));
                }
            }

            $option->setValue($option->getMode() !== GetOpt::NO_ARGUMENT ? $getValue($option) : null);
        };

        $setCommand = function (Command $command) {
            $this->addOptions($command->getOptions());
            $this->addOperands($command->getOperands());
            $this->command = $command;
        };

        $addOperand = function ($value) {
            $operand = $this->nextOperand();
            if ($operand) {
                $operand->setValue($value);
            } elseif ($this->get(self::SETTING_STRICT_OPERANDS)) {
                throw new Unexpected(sprintf(
                    self::translate('no-more-operands'),
                    $value
                ));
            } else {
                $this->additionalOperands[] = $value;
            }
        };

        $this->additionalOptions  = [];
        $this->additionalOperands = [];
        $this->operandsCount = 0;

        $arguments->process($this, $setOption, $setCommand, $addOperand);

        if (($operand = $this->nextOperand()) && $operand->isRequired() &&
            (!$operand->isMultiple() || count($operand->getValue()) === 0)
        ) {
            throw new Missing(sprintf(self::translate('operand-missing'), $operand->getName()));
        }
    }
723479
protected function getParameter($args, $key, $defaultValue = NULL)
    {
        $value = util::array_get($args[$key]);
        return is_null($value) ? $defaultValue : $value;
    }
897886
private function prepareType($arg){
        if(($arg===null || $arg=='null') && $arg !== 0){
            return 'NULL';
        }//if
        if(!is_numeric($arg)){
            return $this->quote($arg);
        }//if
        return $arg;
    }
769466
protected function processArgumentValue(stdClass $argument) {
		if (! isset($argument->value)) {
			throw new Exceptions\InvalidConfig('Argument of type "value" must contain a "value" property');
		}

		if (is_array($argument->value)) {
			return $this->processArguments($argument->value);
		}

		return $argument->value;
	}
621132
public function go($arg = null)
    {
        // Assign converter path
        $ffmpeg = self::getConverterPath();

        // Check if user provided raw arguments
        if (is_null($arg)) 
        {
            // If not, use the prepared arguments
            $arg = implode(' ', $this->parameters);
        }

        // Return input and output files
        $input  = implode(' ', $this->input);
        $output = implode(' ', $this->output);

        // Prepare the command
        $cmd = escapeshellcmd($ffmpeg.' '.$input.' '.$arg.' '.$output);

        // Check if progress reporting is enabled
        if (Config::get('sonus::progress') === true) 
        {
            // Get temp dir
            $tmpdir = self::getTempPath();

            // Get progress id
            if (empty($this->progress)) 
            {
                // Create a default (unix timestamp)
                $progress = date('U');
            } else {
                // Assign if it exists
                $progress = $this->progress;
            }

            // Publish progress to this ID
            $cmd = $cmd.' 1>"'.$tmpdir.$progress.'.sonustmp" 2>&1';

            // Execute command
            return shell_exec($cmd);
        } else {
            // Execute command
            return shell_exec($cmd);
        }
    }
112096
public function handleDefine(Args $args)
    {
        $flags = $args->isOptionSet('force') ? DiscoveryManager::OVERRIDE : 0;
        $bindingParams = array();
        $paramDescriptions = array();

        $this->parseParamDescriptions($args, $paramDescriptions);
        $this->parseParams($args, $bindingParams);

        $this->discoveryManager->addRootTypeDescriptor(new BindingTypeDescriptor(
            new BindingType($args->getArgument('name'), $bindingParams),
            $args->getOption('description'),
            $paramDescriptions
        ), $flags);

        return 0;
    }
1254736
protected function processArgumentArray(Element $arg) {
		$definition = new stdClass();
		
		$definition->type  = 'value';
		$definition->value = [];
				
		foreach ($arg->getContent() as $element) {
			if ($element->getName() !== 'element') {
				throw new InvalidConfig('Array definition must contain only "element" elements', null, null, $arg);
			}
			
			if (isset($element->key)) {
				$definition->value[$element->key] = $this->processArgument($element);
			} else {
				$definition->value[] = $this->processArgument($element);
			}
		}
		
		return $definition;
	}
1038708
public function change($arg, $value = null) {
        $id = $this->getId();
        $this->reset();
        if (!$value) {
            if ($arg instanceof \stdClass) {
                $this->setEntity($arg);
            } else {
                if (!is_array($arg)) {
                    throw new InvalidArgumentException("values is not array");
                }
                foreach ($arg as $key_values) {
                    if (!is_array($key_values)) {
                        throw new InvalidArgumentException("values item must be [key, value]");
                        $this->set($key_values[0], $key_values[1]);
                    }
                };
            }
        } else {
            if (is_array($arg)) {
                $this->set($arg, $value);
            } else {
                $this->set([$arg], $value);
            }
        };
        $this->setId($id);
        return $this->partialUpdate(null);
    }
336239
public function content($arg=null)
	{
		switch($this->format)
		{
			case 'json':
				if(!isset($arg))
				{
					$arg = false;
				}
				return $this->json($arg);
				break;
			case 'xml' :
				if(!isset($arg))
				{
					$arg = 'dom';
				}
				return $this->xml($arg);
				break;
			default :
				return $this->getContent();
				break;
		}
	}
841911
public function execute($args)
    {
        self::$definedProps = new Properties();
        $this->searchForThis = null;

        // 1) First handle any options which should always
        // Note: The order in which these are executed is important (if multiple of these options are specified)

        if (in_array('-help', $args) || in_array('-h', $args)) {
            static::printUsage();

            return;
        }

        if (in_array('-version', $args) || in_array('-v', $args)) {
            static::printVersion();

            return;
        }

        if (in_array('-init', $args) || in_array('-i', $args)) {
            $key = array_search('-init', $args) ?: array_search('-i', $args);
            $path = isset($args[$key + 1]) ? $args[$key + 1] : null;

            self::init($path);

            return;
        }

        if (in_array('-diagnostics', $args)) {
            Diagnostics::doReport(new PrintStream(self::$out));

            return;
        }

        // 2) Next pull out stand-alone args.
        // Note: The order in which these are executed is important (if multiple of these options are specified)

        if (false !== ($key = array_search('-quiet', $args, true)) || false !== ($key = array_search(
            '-q',
            $args,
            true
        ))
        ) {
            self::$msgOutputLevel = Project::MSG_WARN;
            unset($args[$key]);
        }

        if (false !== ($key = array_search('-emacs', $args, true))
            || false !== ($key = array_search('-e', $args, true))
        ) {
            $this->emacsMode = true;
            unset($args[$key]);
        }

        if (false !== ($key = array_search('-verbose', $args, true))) {
            self::$msgOutputLevel = Project::MSG_VERBOSE;
            unset($args[$key]);
        }

        if (false !== ($key = array_search('-debug', $args, true))) {
            self::$msgOutputLevel = Project::MSG_DEBUG;
            unset($args[$key]);
        }

        if (false !== ($key = array_search('-silent', $args, true))
            || false !== ($key = array_search('-S', $args, true))
        ) {
            $this->silent = true;
            unset($args[$key]);
        }

        if (false !== ($key = array_search('-propertyfileoverride', $args, true))) {
            $this->propertyFileOverride = true;
            unset($args[$key]);
        }

        // 3) Finally, cycle through to parse remaining args
        //
        $keys = array_keys($args); // Use keys and iterate to max(keys) since there may be some gaps
        $max = $keys ? max($keys) : -1;
        for ($i = 0; $i <= $max; $i++) {
            if (!array_key_exists($i, $args)) {
                // skip this argument, since it must have been removed above.
                continue;
            }

            $arg = $args[$i];

            if ($arg == "-logfile") {
                try {
                    // see: http://phing.info/trac/ticket/65
                    if (!isset($args[$i + 1])) {
                        $msg = "You must specify a log file when using the -logfile argument\n";
                        throw new ConfigurationException($msg);
                    }

                    $logFile = new PhingFile($args[++$i]);
                    $out = new FileOutputStream($logFile); // overwrite
                    self::setOutputStream($out);
                    self::setErrorStream($out);
                    self::$isLogFileUsed = true;
                } catch (IOException $ioe) {
                    $msg = "Cannot write on the specified log file. Make sure the path exists and you have write permissions.";
                    throw new ConfigurationException($msg, $ioe);
                }
            } elseif ($arg == "-buildfile" || $arg == "-file" || $arg == "-f") {
                if (!isset($args[$i + 1])) {
                    $msg = "You must specify a buildfile when using the -buildfile argument.";
                    throw new ConfigurationException($msg);
                }

                $this->buildFile = new PhingFile($args[++$i]);
            } elseif ($arg == "-listener") {
                if (!isset($args[$i + 1])) {
                    $msg = "You must specify a listener class when using the -listener argument";
                    throw new ConfigurationException($msg);
                }

                $this->listeners[] = $args[++$i];
            } elseif (StringHelper::startsWith("-D", $arg)) {
                // Evaluating the property information //
                // Checking whether arg. is not just a switch, and next arg. does not starts with switch identifier
                if (('-D' == $arg) && (!StringHelper::startsWith('-', $args[$i + 1]))) {
                    $name = $args[++$i];
                } else {
                    $name = substr($arg, 2);
                }

                $value = null;
                $posEq = strpos($name, "=");
                if ($posEq !== false) {
                    $value = substr($name, $posEq + 1);
                    $name = substr($name, 0, $posEq);
                } elseif ($i < count($args) - 1 && !StringHelper::startsWith("-D", $args[$i + 1])) {
                    $value = $args[++$i];
                }
                self::$definedProps->setProperty($name, $value);
            } elseif ($arg == "-logger") {
                if (!isset($args[$i + 1])) {
                    $msg = "You must specify a classname when using the -logger argument";
                    throw new ConfigurationException($msg);
                }

                $this->loggerClassname = $args[++$i];
            } elseif ($arg == "-no-strict") {
                $this->strictMode = false;
            } elseif ($arg == "-strict") {
                $this->strictMode = true;
            } elseif ($arg == "-inputhandler") {
                if ($this->inputHandlerClassname !== null) {
                    throw new ConfigurationException("Only one input handler class may be specified.");
                }
                if (!isset($args[$i + 1])) {
                    $msg = "You must specify a classname when using the -inputhandler argument";
                    throw new ConfigurationException($msg);
                }

                $this->inputHandlerClassname = $args[++$i];
            } elseif ($arg === "-propertyfile") {
                $i = $this->handleArgPropertyFile($args, $i);
            } elseif ($arg === "-keep-going" || $arg === "-k") {
                $this->keepGoingMode = true;
            } elseif ($arg == "-longtargets") {
                self::$definedProps->setProperty('phing.showlongtargets', 1);
            } elseif ($arg == "-projecthelp" || $arg == "-targets" || $arg == "-list" || $arg == "-l" || $arg == "-p") {
                // set the flag to display the targets and quit
                $this->projectHelp = true;
            } elseif ($arg == "-find") {
                // eat up next arg if present, default to build.xml
                if ($i < count($args) - 1) {
                    $this->searchForThis = $args[++$i];
                } else {
                    $this->searchForThis = self::DEFAULT_BUILD_FILENAME;
                }
            } elseif (substr($arg, 0, 1) == "-") {
                // we don't have any more args
                self::printUsage();
                self::$err->write(PHP_EOL);
                throw new ConfigurationException("Unknown argument: " . $arg);
            } else {
                // if it's no other arg, it may be the target
                $this->targets[] = $arg;
            }
        }

        // if buildFile was not specified on the command line,
        if ($this->buildFile === null) {
            // but -find then search for it
            if ($this->searchForThis !== null) {
                $this->buildFile = $this->_findBuildFile(self::getProperty("user.dir"), $this->searchForThis);
            } else {
                $this->buildFile = new PhingFile(self::DEFAULT_BUILD_FILENAME);
            }
        }

        try {
            // make sure buildfile (or buildfile.dist) exists
            if (!$this->buildFile->exists()) {
                $distFile = new PhingFile($this->buildFile->getAbsolutePath() . ".dist");
                if (!$distFile->exists()) {
                    throw new ConfigurationException(
                        "Buildfile: " . $this->buildFile->__toString() . " does not exist!"
                    );
                }
                $this->buildFile = $distFile;
            }

            // make sure it's not a directory
            if ($this->buildFile->isDirectory()) {
                throw new ConfigurationException("Buildfile: " . $this->buildFile->__toString() . " is a dir!");
            }
        } catch (IOException $e) {
            // something else happened, buildfile probably not readable
            throw new ConfigurationException("Buildfile: " . $this->buildFile->__toString() . " is not readable!");
        }

        $this->loadPropertyFiles();

        $this->readyToRun = true;
    }
1270246
public static function Concat( $context, $args )
	{
		$sb = array();
		if ( count( $args ) < 2 )
		    throw XPath2Exception::withErrorCodeAndParams( "XPST0017", Resources::XPST0017,
				array(
					"concat",
					count( $args ),
					XmlReservedNs::xQueryFunc,
				)
			);

		foreach ( $args as $arg )
			if ( ! $arg instanceof Undefined )
				$sb[] = CoreFuncs::Atomize( CoreFuncs::StringValue( $context, $arg ) );

		$result = implode( "", $sb );
		return XPath2Item::fromValueAndType( $result, XmlSchema::$String );
	}
621770
public function removeArgument(IArgument $arg): IRequest
    {
        if ($arg instanceof IMergeableArgument) {
            if (!isset($this->mergeableArguments[$arg->getKey()])) {
                throw new \InvalidArgumentException("This argument doesn't exists");
            }
            $this->mergeableArguments[$arg->getKey()]->removeArgument($arg);

            if ($this->mergeableArguments[$arg->getKey()]->isEmpty()) {
                unset($this->mergeableArguments[$arg->getKey()]);
            }
        } elseif ($arg instanceof IStackableArgument) {
            if (!isset($this->stackableArguments[$arg->getKey()])) {
                throw new \InvalidArgumentException("This argument doesn't exists");
            }
            $this->stackableArguments[$arg->getKey()]->removeArgument($arg);

            if ($this->stackableArguments[$arg->getKey()]->isEmpty()) {
                unset($this->stackableArguments[$arg->getKey()]);
            }
        } else {
            unset($this->arguments[$arg->getKey()]);
        }

        return $this;
    }