public function stream_open($path, $mode, $options, &$opened_path)
    {
        $path = str_replace(array($this->_protocol.'://', '/'), array('', DIRECTORY_SEPARATOR), $path);

        $this->classname = basename($path);
        if (dirname($path) && dirname($path) != DIRECTORY_SEPARATOR) {
            $this->namespace .= NAMESPACE_SEPARATOR.str_replace(
                DIRECTORY_SEPARATOR, NAMESPACE_SEPARATOR, dirname($path)
            );
        }

        $this->_path = $this->resolveFilePath($path);
        if (is_file($this->_path) && is_readable($this->_path)) {
            $this->_stat = @stat($this->_path);

            if (null !== $this->_cache) {
                $expire = new \DateTime();
                $expire->setTimestamp($this->_stat['mtime']);
                $this->_data = $this->_cache->load(md5($this->_path), false, $expire);

                if (false !== $this->_data) {
                    return true;
                }
            }

            try {
                $yamlDatas = parserYaml::parse(file_get_contents($this->_path));
                if (null !== $this->_application) {
                    $event = new Event(
                        $this->namespace . NAMESPACE_SEPARATOR . $this->classname,
                        ['data' => $yamlDatas]
                    );

                    $this->_application
                        ->getEventDispatcher()
                        ->triggerEvent(
                            'streamparsing',
                            $this->namespace . NAMESPACE_SEPARATOR . $this->classname,
                            null,
                            $event
                        );

                    $this->_application
                        ->getEventDispatcher()
                        ->dispatch(
                            'classcontent.streamparsing',
                            $event
                    );

                    if ($event->hasArgument('data')) {
                        $yamlDatas = $event->getArgument('data');
                    }
                }
            } catch (ParseException $e) {
                throw new ClassWrapperException($e->getMessage());
            }

            if ($this->checkDatas($yamlDatas)) {
                $this->_data = $this->_buildClass();
                $opened_path = $this->_path;

                if (null !== $this->_cache) {
                    $this->_cache->save(md5($this->_path), $this->_data);
                }

                return true;
            }
        }

        throw new BBException(sprintf('Class \'%s\' not found', $this->namespace.NAMESPACE_SEPARATOR.$this->classname));
    }
public function stream_open($path, $mode, $options, &$opened_path)
    {
        $path = str_replace(array($this->_protocol.'://', '/'), array('', DIRECTORY_SEPARATOR), $path);

        $this->classname = basename($path);
        if (dirname($path) && dirname($path) != DIRECTORY_SEPARATOR) {
            $this->namespace .= NAMESPACE_SEPARATOR.str_replace(
                DIRECTORY_SEPARATOR, NAMESPACE_SEPARATOR, dirname($path)
            );
        }

        $this->_path = $this->resolveFilePath($path);
        if (is_file($this->_path) && is_readable($this->_path)) {
            $this->_stat = @stat($this->_path);

            if (null !== $this->_cache) {
                $expire = new \DateTime();
                $expire->setTimestamp($this->_stat['mtime']);
                $this->_data = $this->_cache->load(md5($this->_path), false, $expire);

                if (false !== $this->_data) {
                    return true;
                }
            }

            try {
                $yamlDatas = parserYaml::parse(file_get_contents($this->_path));
                if (null !== $this->_application) {
                    $event = new Event(
                        $this->namespace . NAMESPACE_SEPARATOR . $this->classname,
                        ['data' => $yamlDatas]
                    );

                    $this->_application
                        ->getEventDispatcher()
                        ->triggerEvent(
                            'streamparsing',
                            $this->namespace . NAMESPACE_SEPARATOR . $this->classname,
                            null,
                            $event
                        );

                    $this->_application
                        ->getEventDispatcher()
                        ->dispatch(
                            'classcontent.streamparsing',
                            $event
                    );

                    if ($event->hasArgument('data')) {
                        $yamlDatas = $event->getArgument('data');
                    }
                }
            } catch (ParseException $e) {
                throw new ClassWrapperException($e->getMessage());
            }

            if ($this->checkDatas($yamlDatas)) {
                $this->_data = $this->_buildClass();
                $opened_path = $this->_path;

                if (null !== $this->_cache) {
                    $this->_cache->save(md5($this->_path), $this->_data);
                }

                return true;
            }
        }

        throw new BBException(sprintf('Class \'%s\' not found', $this->namespace.NAMESPACE_SEPARATOR.$this->classname));
    }
public function stream_open ( $ path , $ mode , $ options , & $ opened_path ) { $ path = str_replace ( array ( $ this -> _protocol . '://' , '/' ) , array ( '' , DIRECTORY_SEPARATOR ) , $ path ) ; $ this -> classname = basename ( $ path ) ; if ( dirname ( $ path ) && dirname ( $ path ) != DIRECTORY_SEPARATOR ) { $ this -> namespace .= NAMESPACE_SEPARATOR . str_replace ( DIRECTORY_SEPARATOR , NAMESPACE_SEPARATOR , dirname ( $ path ) ) ; } $ this -> _path = $ this -> resolveFilePath ( $ path ) ; if ( is_file ( $ this -> _path ) && is_readable ( $ this -> _path ) ) { $ this -> _stat = @ stat ( $ this -> _path ) ; if ( null !== $ this -> _cache ) { $ expire = new \ DateTime ( ) ; $ expire -> setTimestamp ( $ this -> _stat [ 'mtime' ] ) ; $ this -> _data = $ this -> _cache -> load ( md5 ( $ this -> _path ) , false , $ expire ) ; if ( false !== $ this -> _data ) { return true ; } } try { $ yamlDatas = parserYaml :: parse ( file_get_contents ( $ this -> _path ) ) ; if ( null !== $ this -> _application ) { $ event = new Event ( $ this -> namespace . NAMESPACE_SEPARATOR . $ this -> classname , [ 'data' => $ yamlDatas ] ) ; $ this -> _application -> getEventDispatcher ( ) -> triggerEvent ( 'streamparsing' , $ this -> namespace . NAMESPACE_SEPARATOR . $ this -> classname , null , $ event ) ; $ this -> _application -> getEventDispatcher ( ) -> dispatch ( 'classcontent.streamparsing' , $ event ) ; if ( $ event -> hasArgument ( 'data' ) ) { $ yamlDatas = $ event -> getArgument ( 'data' ) ; } } } catch ( ParseException $ e ) { throw new ClassWrapperException ( $ e -> getMessage ( ) ) ; } if ( $ this -> checkDatas ( $ yamlDatas ) ) { $ this -> _data = $ this -> _buildClass ( ) ; $ opened_path = $ this -> _path ; if ( null !== $ this -> _cache ) { $ this -> _cache -> save ( md5 ( $ this -> _path ) , $ this -> _data ) ; } return true ; } } throw new BBException ( sprintf ( 'Class \'%s\' not found' , $ this -> namespace . NAMESPACE_SEPARATOR . $ this -> classname ) ) ; }
Opens a stream content for a yaml file.

@see BackBee\Stream\ClassWrapper.IClassWrapper::stream_open()

@throws BBException           Occurs when none yamel files were found
@throws ClassWrapperException Occurs when yaml file is not a valid class content description
Opens a stream content for a yaml file .