vendor/braintree/braintree_php/lib/Braintree/Collection.php

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php // phpcs:disable PEAR.Commenting.FunctionComment.MissingParamComment

namespace Braintree;

use Countable;
use IteratorAggregate;
use ArrayAccess;
use OutOfRangeException;
use ArrayIterator;

/**
 * Braintree Generic collection
 *
 * Based on Generic Collection class from:
 * {@link http://codeutopia.net/code/library/CU/Collection.php}
 */

class Collection implements Countable, IteratorAggregate, ArrayAccess
{
    protected $_collection = [];

    /**
     * Add a value into the collection
     *
     * @param string $value to be added
     *
     * @return mixed
     */
    public function add($value)
    {
        $this->_collection[] = $value;
    }

    /**
     * Set index's value
     *
     * @param integer $index thats being set
     * @param mixed   $value to set at the index
     *
     * @throws OutOfRangeException
     *
     * @return mixed
     */
    public function set($index, $value)
    {
        if ($index >= $this->count()) {
            throw new OutOfRangeException('Index out of range');
        }

        $this->_collection[$index] = $value;
    }

    /**
     * Remove a value from the collection
     *
     * @param integer $index index to remove
     *
     * @throws OutOfRangeException if index is out of range
     *
     * @return mixed
后面还有 133 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。