intersect

@param array[]|static[] ...$args

@return  static

@since  3.5
762780
public function intersect(...$args): self
    {
        $args = array_map([Arr::class, 'toArray'], $args);

        return new static(array_intersect($this->storage, ...$args));
    }
424487
public static function getInstance(...$args)
    {
        $class = static::class;

        if (empty(static::$instances[$class])) {
            static::$instances[$class] = Ioc::getContainer()->newInstance($class, ...$args);
        }

        return static::$instances[$class];
    }
809622
public function withArgs($args = [])
    {
        if (!is_array($args)) {
            $args = func_get_args();
        }

        $this->args = $args;
        return $this;
    }
19870
public function orOn(...$args)
    {
        $this->createToken(
            'OR',
            $args,
            $this->joinTokens[$this->activeJoin]['on'],
            $this->onWrapper()
        );

        return $this;
    }
1188907
public function forward(Argument $args)
    {
        $args = $this->protectArgs($args);
        $limit = $args['first'];
        $offset = $this->connectionBuilder->getOffsetWithDefault($args['after'], 0);

        // If we don't have a cursor or if it's not valid, then we must not use the slice method
        if (!\is_numeric($this->connectionBuilder->cursorToOffset($args['after'])) || !$args['after']) {
            $entities = \call_user_func($this->fetcher, $offset, $limit ? $limit + 1 : $limit);

            return $this->handleEntities($entities, function ($entities) use ($args) {
                return $this->connectionBuilder->connectionFromArray($entities, $args);
            });
        } else {
            $entities = \call_user_func($this->fetcher, $offset, $limit ? $limit + 2 : $limit);

            return $this->handleEntities($entities, function ($entities) use ($args, $offset) {
                return $this->connectionBuilder->connectionFromArraySlice($entities, $args, [
                    'sliceStart' => $offset,
                    'arrayLength' => $offset + \count($entities),
                ]);
            });
        }
    }
307858
public static function instance( $args = array() ) {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self( $args );
		}

		return self::$instance;
	}
367439
public static function max(array $args)
    {
        uasort(
            $args,
            function ($a, $b) {
                return count($a) < count($b) ? 1 : -1;
            }
        );
        return count(reset($args));
    }
937268
public static function merge2(...$args): array
    {
        /** @var array[] $args */
        $res = array_shift($args);

        while (!empty($args)) {
            /** @var array $next */
            $next = array_shift($args);

            foreach ($next as $k => $v) {
                if (\is_int($k)) {
                    if (isset($res[$k])) {
                        $res[] = $v;
                    } else {
                        $res[$k] = $v;
                    }
                } elseif (\is_array($v) && isset($res[$k]) && \is_array($res[$k])) {
                    $res[$k] = self::merge2($res[$k], $v);
                } else {
                    $res[$k] = $v;
                }
            }
        }

        return $res;
    }
142469
public function merge($arg)
	{
		$arguments = array_map(function ($array)
		{
			if ($array instanceof DataContainer)
			{
				return $array->getContents();
			}

			return $array;

		}, func_get_args());

		$data = call_user_func_array('Arr::merge', $arguments);

		$this->set($data);

		return $this;
	}
890745
public static function iPMatchFunc(...$args)
    {
        $ip1 = $args[0];
        $ip2 = $args[1];

        return self::iPMatch($ip1, $ip2);
    }
918614
public function intersect( \PhpSets\Set $set ) {
        $iterator = $set->entries();
        $intersect = new \PhpSets\Set;

        while ( $iterator->valid() ) {
            if ( $this->has( $iterator->current() ) ) {
                $intersect->add( $iterator->current() );
            }
            $iterator->next();
        }
        $iterator->rewind();

        return $intersect;
    }
702426
public function diffKeys(...$args): self
    {
        $args = array_map([Arr::class, 'toArray'], $args);

        return new static(array_diff_key($this->storage, ...$args));
    }
516464
public function createSessionAsync(array $args)
    {
        $database = $this->pluck('database', $args);
        $opts = $this->addResourcePrefixHeader([], $database);
        $opts['credentialsWrapper'] = $this->credentialsWrapper;
        $transport = $this->spannerClient->getTransport();

        $request = new CreateSessionRequest([
            'database' => $database
        ]);

        $session = $this->pluck('session', $args, false);

        if ($session) {
            $sessionMessage = new Session($session);
            $request->setSession($sessionMessage);
        }

        return $transport->startUnaryCall(
            new Call(
                'google.spanner.v1.Spanner/CreateSession',
                Session::class,
                $request
            ),
            $opts
        );
    }
307526
public function explain(array $matchers, array $arguments): MatcherResult
    {
        $isMatch = true;
        $matcherMatches = [];
        $argumentMatches = [];
        $argumentCount = count($arguments);
        $index = 0;

        foreach ($matchers as $matcher) {
            if ($matcher instanceof WildcardMatcher) {
                $matcherIsMatch = true;
                $innerMatcher = $matcher->matcher();
                $minimumArguments = $matcher->minimumArguments();
                $maximumArguments = $matcher->maximumArguments();

                for ($count = 0; $count < $minimumArguments; ++$count) {
                    if ($index >= $argumentCount) {
                        $matcherIsMatch = false;
                        $argumentMatches[] = false;

                        break;
                    }

                    if ($innerMatcher->matches($arguments[$index])) {
                        $argumentMatches[] = true;
                    } else {
                        $matcherIsMatch = false;
                        $argumentMatches[] = false;
                    }

                    ++$index;
                }

                if ($maximumArguments < 0) {
                    while (
                        $index < $argumentCount &&
                        $innerMatcher->matches($arguments[$index])
                    ) {
                        $argumentMatches[] = true;
                        ++$index;
                    }
                } else {
                    for (; $count < $maximumArguments; ++$count) {
                        if (
                            $index >= $argumentCount ||
                            !$innerMatcher->matches($arguments[$index])
                        ) {
                            break;
                        }

                        $argumentMatches[] = true;
                        ++$index;
                    }
                }

                $isMatch = $isMatch && $matcherIsMatch;
                $matcherMatches[] = $matcherIsMatch;

                continue;
            }

            $matcherIsMatch =
                $index < $argumentCount &&
                $matcher->matches($arguments[$index]);

            $isMatch = $isMatch && $matcherIsMatch;
            $matcherMatches[] = $matcherIsMatch;
            $argumentMatches[] = $matcherIsMatch;
            ++$index;
        }

        for (; $index < $argumentCount; ++$index) {
            $argumentMatches[] = false;
            $isMatch = false;
        }

        return new MatcherResult($isMatch, $matcherMatches, $argumentMatches);
    }
1003523
public function fetchSingle(...$args)
    { 
        $args[] = QB::limit(1);
        $select = $this->select($args);
        return $select->fetch();
    }
438208
private static function _intersect($values, $options){

		$filtered = [];

		foreach($values as $option){

			$option = static::_nullValue($option);

			if(in_array($option, $options)){

				$filtered[] = $option;
			}
		}

		return $filtered;
	}
863258
public static function coalesce($args)
    {
        $args = func_get_args();
        foreach ($args as &$arg) {
            if (isset($arg) && !empty($arg)) {
                return $arg;
            }
        }

        return null;
    }