Apache Zeta Components Manual :: File Source for arguments.php
Source for file arguments.php
Documentation is available at arguments.php
* File containing the ezcConsoleArguments collection class.
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* @version //autogentag//
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* Collection class for ezcConsoleArgument objects. Used in {@link ezcConsoleInput}.
* Ordered list of arguments.
* @var array(ezcConsoleArgument)
* Named list of arguments.
* @var array(string=>ezcConsoleArgument)
* Returns if the given offset exists.
* This method is part of the ArrayAccess interface to allow access to the
* data of this object as if it was an array. Valid offsets are integers or
* strings. If an integer is used, it refers to the position in the command
* line. A string refers to the arguments name property.
* @param mixed $offset The offset to check.
* @return bool True when the offset exists, otherwise false.
* @throws ezcBaseValueException
* If the provided offset is neither an integer, nor a string.
* Returns the element with the given offset.
* This method is part of the ArrayAccess interface to allow access to the
* data of this object as if it was an array. Valid offsets are integers or
* strings. If an integer is used, it refers to the position in the command
* line. A string refers to the arguments name property.
* @param string|integer$offset The offset to check.
* @return ezcConsoleArgument
* @throws ezcBaseValueException
* If the provided offset is neither an integer, nor a string.
if ( isset
( $this[$offset] ) )
return $this->named[$offset];
if ( isset
( $this[$offset] ) )
* Set the element with the given offset.
* This method is part of the ArrayAccess interface to allow access to the
* data of this object as if it was an array. In contrast to the other
* ArrayAccess implementations of this class, this method allows only integer
* @param int $offset The offset to assign an item to.
* @param ezcConsoleArgument $value The argument object to register.
* @throws ezcBaseValueException
* If a non integer offset is provided.
* @throws ezcBaseValueException
* If the provided value is not of type {@ling ezcConsoleTableRow}.
* @throws ezcConsoleArgumentAlreadyRegisteredException
* If an argument with the given offset or name is already registered.
// Determine key if not set (using $obj[] = ...)
// Set access only allowed with integer values
if ( isset
( $this->ordered[$offset] ) )
if ( isset
( $this->named[$value->name] ) )
$this->named[$value->name] =
$value;
case ( $value ===
null ):
// Aliasing unset() with assignement to null
* Unset the element with the given offset.
* This method is part of the ArrayAccess interface to allow access to the
* data of this object as if it was an array. In contrast to the other
* ArrayAccess implementations of this class, this method allows only integer
* @param int $offset The offset to unset the value for.
* @throws ezcBaseValueException
* If a non numeric row offset is used.
// Set access only allowed with integer values
if ( is_int( $offset ) ===
false )
* Returns the currently selected argument from the list.
* @return ezcConsoleArgument
* Returns the key of the currently selected argument from the list.
* Used by foreach-Loops. In contrast to the iteration direction, which is
* defined by the ordered list of arguments, this is the name of the
* Advances the internal pointer to the next argument and returns it.
* @return ezcConsoleArgument
* Rewinds the internal pointer to the first argument and returns it.
* @return ezcConsoleArgument
* Checks if the current position is valid.
* Returns the number of registered arguments.