src/Algorithms.php
protected function getValidClass($type, $name)
    {
        $logging = \Plop\Plop::getInstance();;
        $w = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890\\';
        if (!is_string($name) || strspn($name, $w) !== strlen($name)) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (invalid class name)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        // Non-existing classes.
        $class = "\\fpoirotte\\Pssht\\$type$name";
        if (!class_exists($class)) {
            if (!interface_exists($class)) {
                $logging->debug(
                    'Skipping %(type)s algorithm "%(name)s" (class does not exist)',
                    array('type' => $type, 'name' => $name)
                );
            }
            return null;
        }

        // Abstract classes.
        $reflector = new \ReflectionClass($class);
        if ($reflector->isAbstract()) {
            return null;
        }

        // Classes that implement AvailabilityInterface
        // where the algorithm is not currently available.
        $iface = '\\fpoirotte\\Pssht\\AvailabilityInterface';
        if ($reflector->implementsInterface($iface) && !$class::isAvailable()) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (not available)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        // Classes that do not implement the proper interface.
        $iface = $this->interfaces[$type];
        if ($iface !== null && !$reflector->implementsInterface($iface)) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (invalid interface)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        return $class;
    }
protected function getValidClass($type, $name)
    {
        $logging = \Plop\Plop::getInstance();;
        $w = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890\\';
        if (!is_string($name) || strspn($name, $w) !== strlen($name)) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (invalid class name)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        // Non-existing classes.
        $class = "\\fpoirotte\\Pssht\\$type$name";
        if (!class_exists($class)) {
            if (!interface_exists($class)) {
                $logging->debug(
                    'Skipping %(type)s algorithm "%(name)s" (class does not exist)',
                    array('type' => $type, 'name' => $name)
                );
            }
            return null;
        }

        // Abstract classes.
        $reflector = new \ReflectionClass($class);
        if ($reflector->isAbstract()) {
            return null;
        }

        // Classes that implement AvailabilityInterface
        // where the algorithm is not currently available.
        $iface = '\\fpoirotte\\Pssht\\AvailabilityInterface';
        if ($reflector->implementsInterface($iface) && !$class::isAvailable()) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (not available)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        // Classes that do not implement the proper interface.
        $iface = $this->interfaces[$type];
        if ($iface !== null && !$reflector->implementsInterface($iface)) {
            $logging->debug(
                'Skipping %(type)s algorithm "%(name)s" (invalid interface)',
                array('type' => $type, 'name' => $name)
            );
            return null;
        }

        return $class;
    }
protected function getValidClass ( $ type , $ name ) { $ logging = \ Plop \ Plop :: getInstance ( ) ; ; $ w = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890\\' ; if ( ! is_string ( $ name ) || strspn ( $ name , $ w ) !== strlen ( $ name ) ) { $ logging -> debug ( 'Skipping %(type)s algorithm "%(name)s" (invalid class name)' , array ( 'type' => $ type , 'name' => $ name ) ) ; return null ; } // Non-existing classes. $ class = "\\fpoirotte\\Pssht\\$type$name" ; if ( ! class_exists ( $ class ) ) { if ( ! interface_exists ( $ class ) ) { $ logging -> debug ( 'Skipping %(type)s algorithm "%(name)s" (class does not exist)' , array ( 'type' => $ type , 'name' => $ name ) ) ; } return null ; } // Abstract classes. $ reflector = new \ ReflectionClass ( $ class ) ; if ( $ reflector -> isAbstract ( ) ) { return null ; } // Classes that implement AvailabilityInterface // where the algorithm is not currently available. $ iface = '\\fpoirotte\\Pssht\\AvailabilityInterface' ; if ( $ reflector -> implementsInterface ( $ iface ) && ! $ class :: isAvailable ( ) ) { $ logging -> debug ( 'Skipping %(type)s algorithm "%(name)s" (not available)' , array ( 'type' => $ type , 'name' => $ name ) ) ; return null ; } // Classes that do not implement the proper interface. $ iface = $ this -> interfaces [ $ type ] ; if ( $ iface !== null && ! $ reflector -> implementsInterface ( $ iface ) ) { $ logging -> debug ( 'Skipping %(type)s algorithm "%(name)s" (invalid interface)' , array ( 'type' => $ type , 'name' => $ name ) ) ; return null ; } return $ class ; }
Check for valid classnames.

\param string $type
Expected type of class (algorithm name).

\param string $name
Name of the class.

\retval string
Full classname (with namespace).

\retval null
No valid class found with this type and name.
Check for valid classnames .