返回指定实例

@static
@access public
@param  mixed $args 实例传参，直接传给构造方法
@return $this
355759
public static function instance($args = null)
    {
        $class = self::className();
        $instanceKey = self::instanceKey($args);

        if ( ! isset(self::$_instances[$instanceKey]))
        {
            self::$_instances[$instanceKey] = is_array($args) ? new $class($args) : new $class;
        }
        return self::$_instances[$instanceKey];
    }
754704
public function args(array $arguments)
    {
        // provide a new instance of the scheduler class if this
        // is the first method that was called.  This allows for
        // $scheduler->opts() to return a new instance of the
        // scheduler when it's first called
        if (count($this->options) == 0) {
            $scheduler = App::make(get_called_class());
            $scheduler->setArguments($arguments);

            return $scheduler;
        }

        $this->setArguments($arguments);

        return $this;
    }
553079
public function add(string ...$args): self
    {
        $classes = $this->getClasses();

        $classes = array_values(array_unique(array_merge($classes, $args)));

        $this->html->setAttribute('class', implode(' ', $classes));

        return $this;
    }
933686
public function andWhere(...$args): self
    {
        $this->createToken('AND', $args, $this->whereTokens, $this->whereWrapper());

        return $this;
    }
1218782
public function removeArgument($arg)
    {
        if (($key = array_search($arg, $this->arguments)) !== false) {
            unset($this->arguments[$key]);
        }

        return $this;
    }
1175142
public function removeArguments(array $arguments = null)
  {
    $this->arguments = array();

    if ($arguments) {
      $this->addArguments($arguments);
    }

    return $this;
  }
650764
public static function get($args = [], $id = '') {
        if (!isset(static::$_instance[static::class])) {
            static::$_instance[static::class] = [];
        }
        if (!isset(static::$_instance[static::class][$id])) {
            static::$_instance[static::class][$id] = new static($args);
        }
        return static::$_instance[static::class][$id];
    }
1140201
public function setMode($arg) {
        $this->mode = strtolower($arg) == self::LIVE ? self::LIVE : self::SANDBOX;
        return $this;
    }
702426
public function diffKeys(...$args): self
    {
        $args = array_map([Arr::class, 'toArray'], $args);

        return new static(array_diff_key($this->storage, ...$args));
    }
1285799
public function add($arg)
    {
        if ( $arg !== null && (!$arg instanceof self || $arg->count() > 0) ) {
            // If we decide to keep Expr\Base instances, we can use this check
            if ( ! is_string($arg)) {
                $class = get_class($arg);

                if ( ! in_array($class, $this->allowedClasses)) {
                    throw new \InvalidArgumentException("Expression of type '$class' not allowed in this context.");
                }
            }

            $this->parts[] = $arg;
        }

        return $this;
    }
1028869
public function removeArgument($arg)
    {
        if (($name = array_search($arg, $this->arguments)) !== false) {
            unset($this->arguments[$name]);
        }

        return $this;
    }
213726
final public function call($method, array $arguments = array())
    {
        $this->definition->addMethodCall($method, static::processValue($arguments, true));

        return $this;
    }
307858
public static function instance( $args = array() ) {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self( $args );
		}

		return self::$instance;
	}
439600
public function setKey($arg) {
        $this->setType(self::CLICK);
        $this->key = $arg;
        return $this;
    }
1069044
static function instance($class, array $args = []) {
    // Get class name
    $class = static::getClass($class);
    // Count args
    switch (count($args)) {
      case 1:   return new $class($args[0]);
      case 2:   return new $class($args[0], $args[1]);
      case 3:   return new $class($args[0], $args[1], $args[2]);
      case 4:   return new $class($args[0], $args[1], $args[2], $args[3]);
      case 5:   return new $class($args[0], $args[1], $args[2], $args[3], $args[4]);
      case 6:   return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
      case 7:   return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6]);
      case 8:   return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7]);
      case 9:   return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8]);
      case 10:  return new $class($args[0], $args[1], $args[2], $args[3], $args[4], $args[5], $args[6], $args[7], $args[8], $args[9]);
    }
    // Return without args
    return new $class();
  }
511694
public function orWhere(...$args): self
    {
        $this->createToken('OR', $args, $this->whereTokens, $this->whereWrapper());

        return $this;
    }
1341398
public function attr(...$args)
    {
        $this->each(function ($item) use ($args) {
            $item->attr(...$args);
        });

        return $this;
    }