public function load($className)
    {
        // get namespace of current instance
        $currentNamespace = $this->namespace.$this->namespaceSeparator;

        // get namespace from passed className
        $namespace = substr($className, 0, strlen($currentNamespace));

        // check if requested class must be loaded by this instance of loader
        // this is a good example use case for namespacing which makes sense
        if (
            $this->namespace === null ||
            $currentNamespace === $namespace
        ) {
            $filename = '';
            $lastNamespaceSeparatorPosition = strripos($className, $this->namespaceSeparator);

            if ($lastNamespaceSeparatorPosition !== false) {
                $namespace = substr($className, 0, $lastNamespaceSeparatorPosition);
                $className = substr($className, $lastNamespaceSeparatorPosition + 1);
                $filename  = str_replace(
                    $this->namespaceSeparator,
                    $this->separator,
                    $namespace
                ).$this->separator;
            }

            $filename .= str_replace('_', $this->separator, $className).'.php';
            $path      = $this->getPath();

            if ($path !== null) {
                foreach ($path as $singlePath) {
                    $filename = $singlePath.$this->separator.$filename;
                    if (file_exists($filename)) {
                        include_once $filename;
                        return true;
                    }
                }
            }
        }

        return false;
    }
public function load($className)
    {
        // get namespace of current instance
        $currentNamespace = $this->namespace.$this->namespaceSeparator;

        // get namespace from passed className
        $namespace = substr($className, 0, strlen($currentNamespace));

        // check if requested class must be loaded by this instance of loader
        // this is a good example use case for namespacing which makes sense
        if (
            $this->namespace === null ||
            $currentNamespace === $namespace
        ) {
            $filename = '';
            $lastNamespaceSeparatorPosition = strripos($className, $this->namespaceSeparator);

            if ($lastNamespaceSeparatorPosition !== false) {
                $namespace = substr($className, 0, $lastNamespaceSeparatorPosition);
                $className = substr($className, $lastNamespaceSeparatorPosition + 1);
                $filename  = str_replace(
                    $this->namespaceSeparator,
                    $this->separator,
                    $namespace
                ).$this->separator;
            }

            $filename .= str_replace('_', $this->separator, $className).'.php';
            $path      = $this->getPath();

            if ($path !== null) {
                foreach ($path as $singlePath) {
                    $filename = $singlePath.$this->separator.$filename;
                    if (file_exists($filename)) {
                        include_once $filename;
                        return true;
                    }
                }
            }
        }

        return false;
    }
public function load ( $ className ) { // get namespace of current instance $ currentNamespace = $ this -> namespace . $ this -> namespaceSeparator ; // get namespace from passed className $ namespace = substr ( $ className , 0 , strlen ( $ currentNamespace ) ) ; // check if requested class must be loaded by this instance of loader // this is a good example use case for namespacing which makes sense if ( $ this -> namespace === null || $ currentNamespace === $ namespace ) { $ filename = '' ; $ lastNamespaceSeparatorPosition = strripos ( $ className , $ this -> namespaceSeparator ) ; if ( $ lastNamespaceSeparatorPosition !== false ) { $ namespace = substr ( $ className , 0 , $ lastNamespaceSeparatorPosition ) ; $ className = substr ( $ className , $ lastNamespaceSeparatorPosition + 1 ) ; $ filename = str_replace ( $ this -> namespaceSeparator , $ this -> separator , $ namespace ) . $ this -> separator ; } $ filename .= str_replace ( '_' , $ this -> separator , $ className ) . '.php' ; $ path = $ this -> getPath ( ) ; if ( $ path !== null ) { foreach ( $ path as $ singlePath ) { $ filename = $ singlePath . $ this -> separator . $ filename ; if ( file_exists ( $ filename ) ) { include_once $ filename ; return true ; } } } } return false ; }
This method is the loader mechanism for this loader configuration

@param string $className The name of the class to load

@author Benjamin Carl <opensource@clickalicious.de>
@return bool TRUE on success, otherwise FALSE
@access public
This method is the loader mechanism for this loader configuration