Write a PHP function/method argument in the current stream.

@param PhpArgument $argument A PhpArgument object.
@throws StreamAccessException If an error occurs while writing the PHP argument.
333718
public function writeArgument(PhpArgument $argument)
    {
        try {
            $value = $argument->getValue();

            if ($argument->isVariableReference() === true) {
                $this->getStream()->write('$' . $value->getName());
            } else {
                $this->writeScalar($value);
            }
        } catch (StreamException $e) {
            $msg = "An error occured while writing an argument with value '${value}'.";
            throw new StreamAccessException($msg, $this, 0, $e);
        }
    }
1372384
function _func()
	{
		$num_args = 0; // number of arguments received
		$function = strtoupper($this->_current_token);
		$result   = ''; // initialize result
		$this->_advance();
		$this->_advance();         // eat the "("
		while ($this->_current_token != ')') {
		/**/
			if ($num_args > 0) {
				if ($this->_current_token == "," or
					$this->_current_token == ";")
				{
					$this->_advance();  // eat the "," or ";"
				} else {
					throw new PHPExcel_Writer_Exception("Syntax error: comma expected in ".
									  "function $function, arg #{$num_args}");
				}
				$result2 = $this->_condition();
				$result = $this->_createTree('arg', $result, $result2);
			} else { // first argument
				$result2 = $this->_condition();
				$result = $this->_createTree('arg', '', $result2);
			}
			++$num_args;
		}
		if (!isset($this->_functions[$function])) {
			throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
		}
		$args = $this->_functions[$function][1];
		// If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid.
		if (($args >= 0) and ($args != $num_args)) {
			throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
		}

		$result = $this->_createTree($function, $result, $num_args);
		$this->_advance();         // eat the ")"
		return $result;
	}
881132
public function writeSpace()
    {
        try {
            $this->getStream()->write(' ');
        } catch (StreamException $e) {
            $msg = "An error occured while writing a white space ( ).";
            throw new StreamAccessException($msg, $this, 0, $e);
        }
    }
49947
private function createArgumentDescriptorForMagicMethod($argument)
    {
        $argumentType = null;
        $argumentName = null;
        $argumentDefault = false; // false means we have not encountered the '=' yet.
        foreach ($argument as $part) {
            $part = trim($part);
            if (!$part) {
                continue;
            }

            // Type should not be assigned after name
            if (!$argumentName && !$argumentType && $part{0} != '$') {
                $argumentType = $part;
            } elseif (!$argumentName && $part{0} == '$') {
                $argumentName = $part;
            } elseif ($part == '=') {
                $argumentDefault = null;
            } elseif ($argumentDefault === null) {
                $argumentDefault = $part;
            }
        }
        if ($argumentDefault === false) {
            $argumentDefault = null;
        }

        // if no name is set but a type is then the input is malformed and we correct for it
        if ($argumentType && !$argumentName) {
            $argumentName = $argumentType;
            $argumentType = null;
        }

        // if there is no type then we assume it is 'mixed'
        if (!$argumentType) {
            $argumentType = 'mixed';
        }

        $argumentDescriptor = new ArgumentDescriptor();
        $argumentDescriptor->setTypes($this->builder->buildDescriptor(new Collection(array($argumentType))));
        $argumentDescriptor->setName($argumentName[0] == '$' ? $argumentName : '$' . $argumentName);
        $argumentDescriptor->setDefault($argumentDefault);

        return $argumentDescriptor;
    }
806559
public static function escapeShellArgument( $argument )
    {
        $escapeChar = self::instance()->ShellEscapeCharacter;
        if ( $escapeChar == "'" )
        {
            $argument = str_replace( "'", "'\\''", $argument );
        }
        else
        {
            $argument = str_replace( $escapeChar, "\\" . $escapeChar, addcslashes( $argument, '\\' ) );
        }
        return $escapeChar . $argument . $escapeChar;
    }
859983
protected function processArguments($arguments)
    {
        if (false === is_array($arguments)) {
            return $arguments;
        }

        return array_map(function ($argument) {
            return (string) $argument;
        }, $arguments);
    }
592182
public function setCallArgument($arg)
    {
        $this->call_argument = $arg;
        $this->args =[
            $this->call_function,
            $this->call_argument
        ];
    }
618911
protected function processCommand($command = '', $argument = '')
    {
        switch ($command) {
            case 'help':
                $this->writeln('
Debug console for phpDaemon.
Allowed commands:

help	eval	exit
');
                break;
            case 'ping':
                $this->writeln('pong');
                break;
            case 'eval':
                ob_start();
                eval($argument);
                $out = ob_get_contents();
                ob_end_clean();
                $this->writeln($out);
                break;
            default:
                $this->writeln('Unknown command "' . $command . '".
Type "help" to get the list of allowed commands.');
        }
    }
1104734
protected function attach($stream)
    {
        if (is_resource($stream) === false) {
            throw new InvalidArgumentException(__METHOD__ . ' argument must be a valid PHP resource');
        }

        $this->stream = $stream;
    }
655874
function CallArguments_Argument(&$res, $sub)
    {
        if (!empty($res['php'])) {
            $res['php'] .= ', ';
        }

        $res['php'] .= ($sub['ArgumentMode'] == 'default') ? $sub['string_php'] :
            str_replace('$$FINAL', 'XML_val', $sub['php']);
    }
543980
private function adaptArgument(Argument $argument)
    {
        $mode = null;

        if ($argument->isMultiValued()) {
            $mode |= InputArgument::IS_ARRAY;
        }

        if ($argument->isOptional()) {
            $mode |= InputArgument::OPTIONAL;
        }

        if ($argument->isRequired()) {
            $mode |= InputArgument::REQUIRED;
        }

        return new InputArgument($argument->getName(), $mode, $argument->getDescription(), $argument->getDefaultValue());
    }
707220
public function appendArgument($argument) {
    if (is_scalar($argument)) {
      $argument = Node::fromValue($argument);
    }

    if ($argument instanceof ExpressionNode) {
      /** @var Node $argument */
      $this->arguments->appendItem($argument);
    }
    else {
      throw new \InvalidArgumentException();
    }

    return $this;
  }
1337561
protected function processArgumentParameter(stdClass $argument) {
		if (! isset($argument->name)) {
			throw new Exceptions\InvalidConfig('Argument of type "parameter" must contain a "name" property');
		}
		
		$config = $this->container->getParametersConfig();
		$name   = trim($argument->name);
		
		if (! empty($argument->deferred)) {
			return new ConfigReference($config, $name);
		}
		
		if (! $config->has($name)) {
			throw new Exceptions\InvalidConfig('Config contains no "' . $name . '" parameter');
		}
		
		return $config->get($name);
	}
1184610
protected function addArgument($argument, $descriptor)
    {
        $params = $descriptor->getTags()->get('param', array());

        if (!$this->argumentAssembler->getBuilder()) {
            $this->argumentAssembler->setBuilder($this->builder);
        }
        $argumentDescriptor = $this->argumentAssembler->create($argument, $params);

        $descriptor->addArgument($argumentDescriptor->getName(), $argumentDescriptor);
    }
1038046
public function offsetSet($offset, $argument)
    {
        if (!is_null($offset) && !is_scalar($offset)) {
            throw new InvalidArgumentException('scalar', 0);
        }

        if (!$argument instanceof TokenInterface) {
            throw new InvalidArgumentException('TokenInterface', 1);
        }

        if (!in_array($argument, $this->children)) {
            $this->children[$offset] = $argument;
        }
    }
1050051
public function translateArgValue($argument)
    {
        if (isset($this->element[$argument])) {
            $this->element[$argument] = Translator::translate($this->element[$argument]);
        }
    }
742634
private function _checkArgument($argument, $name)
    {
        if (!is_string($argument)) {
            $argument = strval($argument);
        }

        if (strlen($argument) == 0) {
            throw new Klarna_ArgumentNotSetException($name);
        }
    }