Esempio n. 1
0
 /**
  *
  * @dataProvider providerTestParseName
  * @param string $name
  */
 public function testParseName($name, $actual, $exceptionName = '')
 {
     $obj = new Miao_Autoload_Name($this->_path);
     $obj->parse($name);
     $expected = $obj->toArray();
     $this->assertEquals($expected, $actual);
 }
Esempio n. 2
0
 /**
  * Разбиваем имя класса на составляющие
  * @param $className
  * @throws Miao_Console_Exception_WrongLibType
  * @return array
  */
 protected function _parse($className)
 {
     $result = array('type' => '', 'name' => '', 'lib' => '', 'module' => '', 'class' => '', 'office' => false);
     try {
         $parser = new Miao_Autoload_Name();
         $parser->parse($className);
         $result = $parser->toArray();
     } catch (Miao_Autoload_Exception $ex) {
         $this->_log('Error parse classname ' . $className, Miao_Log::WARN);
     }
     $autoLoad = Miao_Autoload::getInstance()->getRegisterList();
     $libName = strtolower($result['lib']);
     if (!isset($autoLoad[$libName]) || !$autoLoad[$libName] instanceof Miao_Autoload_Plugin_Standart) {
         throw new Miao_Console_Exception_WrongLibType('Type of autoloader lib must be "standart"!');
     }
     // Обработка Office
     if (!empty($result['class'])) {
         $parts = explode('_', $result['class']);
         if (false !== in_array($parts[0], array('View', 'ViewBlock'))) {
             $result['office'] = true;
         }
     }
     return $result;
 }