2013-04-04 153 views
8

PhalconPHP框架中是否存在任何类型的框架,我可以在Netbeans IDE中使用它来实现自动完成目的?PhalconPHP的IDE自动完成

所有我需要的是具有类/接口声明的文件堆,像这样:

namespace \Phalcon; 

class Tag { 

    /** 
    * bla bla bla 
    * ... 
    */ 
    public static function setTitle($title) {} 

    ... 

} 

回答

22

也许你正在找这个?尔康DevTools https://github.com/phalcon/phalcon-devtools/tree/master/ide

+0

非常感谢!这就是我一直在寻找的! – 2013-04-04 14:02:42

+6

在外部库中添加一个路径到'phalcon-devtools \ ide \ 1.3.1 \ Phalcon' – Patrioticcow 2014-04-08 18:28:23

+0

对于版本3,我添加了我的全局路径:'/ usr/local/share/composer/vendor/phalcon-devtools/ide' – JREAM 2017-03-27 02:23:19

4

您可以提炼出接口我InterfaceDistiller

namespace com\github\gooh\InterfaceDistiller; 
include __DIR__ . '/../src/autoload.php'; 

var_dump(extension_loaded('phalcon')); // should be true 

$phalconClasses = new \RegexIterator(
    new \ArrayIterator(get_declared_classes()), 
    '/^Phalcon/' 
); 

foreach ($phalconClasses as $phalconClass) 
{ 
    $reflector = new \ReflectionClass($phalconClass); 
    $methodIterator = new \ArrayIterator($reflector->getMethods()); 

    $distillate = new Distillate; 
    $distillate->setInterfaceName($reflector->getNamespaceName()); 
    $distillate->setExtendingInterfaces(
     implode(',', $reflector->getInterfaceNames()) 
    ); 

    foreach ($methodIterator as $method) { 
     $distillate->addMethod($method); 
    } 

    $file = new \SplTempFileObject(-1); 
    $writer = new Distillate\Writer($file); 
    $writer->writeToFile($distillate); 
    $file->rewind(); 
    $file->fpassthru(); 
} 

这一操作将产生以下输出:

​​

请参阅full file holding all distilled interfaces of Phalcon

请注意,InterfaceDistiller只能生成接口。所以你不会得到混合的类骨架和接口,而只是接口。

另一个问题是接口方法将全部公开,因为接口方法应该是公开的。您可以使用tweak the writer来使用真实的可视性。或者,您可以限制Distiller将提取哪些方法。

正如您所看到的API的某些部分无法解析。这是因为InterfaceDistiller使用反射从类中提取接口,并且某些值不仅仅以这种方式提供。考虑手动填写无法解析的值。

虽然对于您的UseCase并不完美,但它应该给你一个很好的启动。

如果你决定去适应和完成的文件,因此它完全可用,考虑派遣一拉请求与整个文件到尔康人

+1

谢谢戈登的起点。如果没有人给出更好的答案,在几天内将标记为正确,但现在请从我这里得到赞扬。 – 2013-04-04 11:34:37