Is there exist any kind of skeleton for PhalconPHP framework, which I can use in my Netbeans IDE for autocompletion purposes?
All I need is a heap of files with class/interface declarations, like this:
namespace \Phalcon;
class Tag {
/**
* bla bla bla
* ...
*/
public static function setTitle( $title ) {}
...
}
Maybe you're looking for this? Phalcon DevTools https://github.com/phalcon/phalcon-devtools/tree/master/ide
You can distill the interfaces with my 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();
}
This will then produce the following output:
<?php
interface Phalcon
{
public function __clone();
public function __construct($message /* = unresolvable */, $code /* = unresolvable */, $previous /* = unresolvable */);
public function getMessage();
public function getCode();
public function getFile();
public function getLine();
public function getTrace();
public function getPrevious();
public function getTraceAsString();
public function __toString();
}
// this continues for all classes in the extension
See full file holding all distilled interfaces of Phalcon
Note that the InterfaceDistiller can only produce Interfaces. So you won't get a mix of class skeletons and interface, but just Interfaces.
Another gotcha is that the interface methods will all be public because, well, interface methods should be public. You can either tweak the writer to use the real visibility. Or you can limit which methods the Distiller will distill.
As you can see some parts of the API cannot be resolved. This is because InterfaceDistiller uses Reflection to distill the Interface from the classes and some values are not just available this way. Consider filling in the unresolvable values by hand.
While not perfect for your UseCase, it should give you a great headstart though.
If you decide to adapt and complete the file so it's fully usable, consider sending a Pull Request with the entire file to the Phalcon folks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With