Parse a class name and returns its name and its method.

@param string $class
@param string $hook

@return array
420536
protected function parseClassEvent($class, $hook)
    {
        if (str_contains($class, '@')) {
            return explode('@', $class);
        }

        // If no method is defined, use the hook name as the method name.
        $method = str_contains($hook, '-') ? str_replace('-', '_', $hook) : $hook;

        return [$class, $method];
    }
639458
private function getParentClasses(string $class, $parentClass = []) : array
    {
        if (!$parentClass) {
            $parentClass[] = $class;
        }

        $parent = get_parent_class($class);
        if ($parent) {
            $parentClass[] = $parent;
            $parentClass = self::getParentClasses($parent, $parentClass);
        }

        return $parentClass;
    }
152745
public function loadAll($key = null, $class = '\\stdClass')
    {
        if (strtolower($class) === 'array') {
            return $this->getReader()->loadArrayList($key);
        }

        if (strtolower($class) === 'assoc') {
            return $this->getReader()->loadAssocList($key);
        }

        return $this->getReader()->loadObjectList($key, $class);
    }
239001
public function getTypesForClass(string $class): array
    {
        $types = array_filter(
            $this->typeMap,
            function ($val) use ($class) {
                return $val === $class;
            }
        );

        if (empty($types)) {
            $error = sprintf('Does not exist any valid type for class "%s"', $class);
            throw new \UnexpectedValueException($error);
        }

        return array_keys($types);
    }
222879
public static function className($class)
    {
        $result = App::className($class, 'Model/Behavior', 'Behavior');
        if (!$result) {
            $result = App::className($class, 'ORM/Behavior', 'Behavior');
        }

        return $result ?: null;
    }
1019562
public static function listMethodsFromClass($class)
    {
        $filteredMethods = array();
        $reflection = new ReflectionClass($class);
        $methods = $reflection->getMethods();
        //Todo: lets make a better solution for this
        foreach ($methods as $method) {
            if ($class === $method->class) {
                $filteredMethods[] = $method;
            }
        }
        return $filteredMethods;
    }
568447
public function parse($class, array $meta = [])
    {
        $methods = get_class_methods($class);
        foreach($methods as $method) {
            $query = Annotation::ofMethod($class, $method, 'uri');
            if($query) {
                $this->add($query, [$class, $method], $meta);
            }
        }

        return $this;
    }
539814
public function getAttributeKeys($class = null) {
		foreach($this as $key => $data) {
			if($class) {
				if($data instanceof $class)
					$ret[] = $key;
			} else {
				$ret[] = $key;
			}
		}
		return $ret;
	}
580606
public function getExtendedClass($class)
    {
        $ret = null;
        if (array_key_exists($class, $this->dynamicClasses)) {
            $ret = $this->dynamicClasses[$class];
        }
        if (!$ret) {
            $ret = array_search($class, $this->classes);
        }
        return $ret?$ret:null;
    }
1124919
public static function getAllChildClasses($class): array
    {
        $type = gettype($class);
        $className = '';

        /* If input an object */
        if ($type == 'object') {
            $className = get_class($class);
        }

        /* If input a string */
        elseif ($type == 'string') {
            $className = $class;
        }

        $classes = [];

        /* Go through all classes */
        foreach (get_declared_classes() as $class) {
            if (is_subclass_of($class, $className)) {
                $classes[] = $class;
            }
        }

        return $classes;
    }
886476
public static function getBasename($class)
    {
        if (is_object($class) === true) {
            $class = get_class($class);
        }
        foreach (['\\', '_'] as $separator) {
            $pos = strrpos($class, $separator);
            if ($pos !== false) {
                return substr($class, $pos + 1);
            }
        }
        return $class;
    }
434589
private function getAnnotations($class)
    {
        $parsed = $this->getParser()->parse($class);
        if (!is_array($parsed)) {
            return [];
        }
        $context = [
            'class' => $class,
            'declaringClass' => $class,
            'type' => Context::TYPE_CLASS,
            'name' => $class
        ];
        $annotations = [];
        if (!empty($parsed['class'])) {
            foreach ($parsed['class'] as $value) {
                $anno = $this->create($value, $context);
                if ($anno) {
                    $annotations[] = $anno;
                }
            }
        }
        $map = [
            'methods' => Context::TYPE_METHOD,
            'properties' => Context::TYPE_PROPERTY
        ];
        $reflection = new \ReflectionClass($class);
        foreach ($map as $type_name => $type) {
            if (!empty($parsed[$type_name])) {
                foreach ($parsed[$type_name] as $name => $values) {
                    $reflType = $type == 'method' ? $reflection->getMethod($name)
                               : $reflection->getProperty($name);
                    $context['type'] = $type;
                    $context['name'] = $name;
                    $context['declaringClass'] = $reflType->getDeclaringClass()->getName();
                    foreach ($values as $value) {
                        $anno = $this->create($value, $context);
                        if ($anno) {
                            $annotations[] = $anno;
                        }
                    }
                }
            }
        }
        return $annotations;
    }
877850
public function provider($class)
    {

        $class = ltrim($class, '\\');

        if (isset($this->providers[$class])) {
            return $this->providers[$class];
        }

        if (!isset($this->providerFactories[$class])) {
            throw new HandlerNotFoundException("No provider for class $class found.");
        }

        $this->providers[$class] = call_user_func($this->providerFactories[$class], $class);

        return $this->providers[$class];

    }
758332
public function findHookInDefinition(array $hooksDef, $type, $file, $class, $method)
    {
        foreach ($hooksDef as $defFile => $hooks) {
            if (!array_key_exists($type, $hooks)) {
                continue;
            }

            // Find a hook
            foreach ($hooks[$type] as $hook) {
                if ($hook[2] == $file && $hook[3] == $class && $hook[4] == $method) {
                    return $defFile;
                }
            }
        }
    }
201322
public function getClassAnnotation($class)
    {
        $reflClass = new \ReflectionClass($class);
        $mappedDocumentClass = static::ANNOTATION_CLASS_CLASS;

        foreach ($this->annotationReader->getClassAnnotations($reflClass) as $annotation) {
            if ($annotation instanceof $mappedDocumentClass) {
                return $annotation;
            }
        }

        return null;
    }
141843
private function getMethodParameters(string $class, string $methodName) : array
    {
        $methodReflection = new ReflectionMethod($class, $methodName);
        $parametersName   = [];

        foreach ($methodReflection->getParameters() as $parameter) {
            $parametersName[] = $parameter->name;
        }

        return $parametersName;
    }
717370
protected function getClassFilesetAnnotations($class) {
    $filesets = [];
    $methods = get_class_methods($class);
    foreach ($methods as $method_name) {
      $reflectionMethod = new \ReflectionMethod($class, $method_name);
      $annotations = $this->annotationsReader->getMethodAnnotation($reflectionMethod, 'Acquia\Blt\Annotations\Fileset');
      if ($annotations) {
        $filesets[$annotations->id] = $method_name;
      }
    }

    return $filesets;
  }