Returns true if a class matches a namespace item

@param array $array
@param string $group
@param string $alias
@param string $class
359138
protected function matchClass($array, $group, $alias, $class)
    {
        $match = false;

        foreach ($array as $test) {
            if ('path' === $group) {
                $match = 0 === strpos($class, $test);
            } else {
                $match = $test . '\\' . $alias === $class;
            }

            if ($match) {
                break;
            }
        }

        return $match;
    }
728568
public function addGroupAlias($groupName, $alias)
    {
       if(is_array($alias))
           foreach($alias as $item)
               $this->groupAliasIndices[$item] = $groupName;
       else
           $this->groupAliasIndices[$alias] = $groupName;

        return $this;
    }
763412
public function updateGroup(array $group)
    {
        $result = $this->httpRaw(self::WECHAT_GROUP_UPDATE_PREFIX, [
            'group' => $group
        ], [
            'access_token' => $this->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'ok';
    }
535477
protected function getIdentifierFromArray($class, $array)
    {
        $meta = $this->entityMetadataFactory->getMetadataFor($class);
        $fields = $meta->getIdentifierFieldNames();

        $ids = array();
        foreach ($fields as $field) {
            if (isset($array[$field])) {
                $ids[$field] = $array[$field];
            } else {
                $tmp = $array;
                $parts = explode('.', $field);
                foreach ($parts as $part) {
                    if (isset($tmp[$part])) {
                        if (is_array($tmp[$part])) {
                            $tmp = $tmp[$part];
                        } else {
                            $ids[$field] = $tmp[$part];

                            break;
                        }
                    }
                }
            }
        }

        return $ids;
    }
469009
public static function find( $class ) 
	{	
		if ( class_exists( $class, false ) )
		{
			return;
		}

		// class with or without namespace?
		if ( strpos( $class , '\\' ) !== false ) 
		{
			/*
			 * alias map
			 */
			if ( array_key_exists( $class, static::$aliases ) ) 
			{
				require static::$aliases[$class];
			}
			/* 
			 * normal map
			 */
			elseif ( array_key_exists( $class, static::$classes ) ) 
			{
				require static::$classes[$class];
			}
			/*
			 * try your luck without the map
			 */
			else 
			{	
				$namespace = substr( $class, 0, strrpos( $class, "\\" ) );
				$class_name = substr( $class, strrpos( $class, "\\" )+1 );
				
				if ( !array_key_exists( $namespace, static::$namespaces ) ) 
				{
					return false;
				}
				
				$path = static::$namespaces[$namespace].str_replace( '_', '/', $class_name ).EXT;
				
				if ( !file_exists( $path ) ) 
				{
					return false;
				}
				
				require $path;
			}
			
			/*
			 * check if we need to create a shadow aka an alias
			 */
			if ( in_array( $class, static::$shadows ) )
			{
				$shadow = array_search( $class, static::$shadows );
				
				if ( !class_exists( $shadow, false ) && !array_key_exists( $shadow, static::$aliases ) )
				{
					class_alias( $class, $shadow ); 
				}
			}
		}
		else 
		{
			/*
			 * alias map
			 */
			if ( array_key_exists( $class, static::$aliases ) ) 
			{
				require static::$aliases[$class];
			}
			/*
			 * check shadows
			 */
			if ( array_key_exists( $class, static::$shadows ) )
			{
				return static::find( static::$shadows[$class] );
			}
			/* 
			 * normal map
			 */
			elseif ( array_key_exists( $class, static::$classes ) ) 
			{
				require static::$classes[$class];
			}
			/*
			 * try your luck without the map
			 */
			else 
			{
				$path = APPPATH.CCDIR_CLASS.str_replace( '_', '/', $class ).EXT;
				
				if ( !file_exists( $path ) ) 
				{
					return false;
				}
				
				require $path ;
			}
		}
		
		/*
		 * run the static init if possible
		 */
		if ( method_exists( $class, '_init' ) ) 
		{
			$class::_init();
		}
		
		return true;
	}
508721
public function isRegistered($alias)
    {
        $alias = $this->inflectClassName($alias);

        $isRegistered = parent::isRegistered($alias);
        if ( !$isRegistered ) {
            if ( array_key_exists($alias, $this->aliases) ) {
                return TRUE;
            }
        }

        return $isRegistered;
    }
99716
public function alias(array $class = [], string $alias = null) : Manager
    {
        if (!is_array($class)) {
            $this->set($class, $alias);

            return $this;
        }

        $this->aliases = array_merge($this->get(), $class);

        return $this;
    }
276783
public function aliasClass($class)
    {
        if (Str::contains($class, '\\')) {
            return;
        }

        $fullName = isset($this->classes[$class])
            ? $this->classes[$class]
            : false;

        if ($fullName) {
            $this->shell->writeStdout("[!] Aliasing '{$class}' to '{$fullName}' for this Tinker session.\n");

            class_alias($fullName, $class);
        }
    }
576633
private function validate_alias_type( $aliases, $alias, $assoc_args, $grouping ) {

		$alias_data = $aliases[ $alias ];

		$group_aliases_match = preg_grep( '/^@(\w+)/i', $alias_data );
		$arg_match           = preg_grep( '/^set-(\w+)/i', array_keys( $assoc_args ) );

		if ( ! empty( $group_aliases_match ) && ! empty( $arg_match ) ) {
			WP_CLI::error( 'Trying to update group alias with invalid arguments.' );
		} elseif ( empty( $group_aliases_match ) && ! empty( $grouping ) ) {
			WP_CLI::error( 'Trying to update simple alias with invalid --grouping argument.' );
		}
	}
625008
public function exists($group, $namespace = null)
    {
        $db = Database::getActiveConnection();
        $query = $db->createQueryBuilder();

        $query
            ->select('count(configGroup)')
            ->from('Config', 'c')
            ->where('configGroup = ?')
            ->setParameter(0, $group)
            ->setMaxResults(1);

        if ($namespace) {
            $query->andWhere('configNamespace = ?')->setParameter(1, $namespace);
        } else {
            $query->andWhere('configNamespace = ? OR configNamespace IS NULL')->setParameter(1, '');
        }
        $row = $query->execute()->fetch();
        $count = array_shift($row);

        return (bool) $count;
    }
1269507
protected function load($group, $namespace, $collection)
    {
        // Is it already loaded? If so, just return it.
        if (isset($this->items[$collection])) return $this->items[$collection];

        $items = $this->loader->load($this->mode, $group, $namespace);

        return $this->items[$collection] = $items;
    }
930691
private function aliasArrayToName(array $aliasArray)
    {
        if ($aliasArray === null || (empty($aliasArray['width']) && empty($aliasArray['height']))) {
            return $this->originalDir;
        }

        if (!empty($aliasArray['focus'])) {
            if (!in_array($aliasArray['focus'], array(true, false))) {
                throw new \Exception('Focus must be a boolean type');
            }

            $end = ($aliasArray['focus'] === true) ? '_focus' : '';
        } else {
            $end = '';
        }

        if (!empty($aliasArray['width']) && !empty($aliasArray['height'])) {
            return $aliasArray['width'].'x'.$aliasArray['height'].$end;
        }

        if (!empty($aliasArray['width'])) {
            return $aliasArray['width'].'x';
        }

        if (!empty($aliasArray['height'])) {
            return 'x'.$aliasArray['height'];
        }
    }
780725
public function isAssociative(array $array)
    {
        if (empty($array)) {
            return false;
        }

        for ($iterator = count($array) - 1; $iterator; $iterator--) {
            if ( ! array_key_exists($iterator, $array)) {
                return true;
            }
        }

        return ! array_key_exists(0, $array);
    }
573525
protected function destroyGroupAction($class)
    {
        $result = $class::destroy($this->request->id);
        if ( is_integer($result) && $result > 0) {
            return true;
        }
        return false;
    }
442718
public function hasGroup($key)
    {
        list($namespace, $group) = $this->parseKey($key);

        return $this->loader->exists($group, $namespace);
    }
1122284
protected function activateGroupAction($class)
    {
        $users = $class::whereIn('id', $this->request->id)->get();
        foreach($users as $user) {
            $this->setModel($user);
            $this->activationComplete();
        }
        return true;
    }
905414
private function isAssocStr($array)
    {
        if(!is_array($array)){
            return false;
        }
        for (reset($array); is_int(key($array));
             next($array)) {
            if (is_null(key($array)))
                return false;
        }
        return true;
    }