How do I make an inline #link to another class in Apigen? - php

I'm trying to create a #link from one method to another method in a different class. Example:
class Bar extends Foo
{
/**
* This link works: {#link barFunction()}
* This link also works: {#link fooFunction()}
* This link doesn't work: {#link Foo::fooFunction()}
*/
public function fooFunction()
{
}
/**
* Bar function is another function
*/
public function barFunction()
{
}
}
The inline #link within the same class works OK. But the inline link to another class does not generate a link to the documentation. Instead, it generates:
Foo::fooFunction()
Am I doing something wrong or am I simply trying to achieve what is not possible? I looked over Apigen documentation and their forums (both at GitHub and Google Groups) but without any success. Thanks for your help.

Related

How do you register custom methods like those within Application.php in Laravel

I am wondering how to register custom method within:
Illuminate/Foundation/Application.php
Like:
/**
* Get the current application name.
*
* #return string
*/
public function getName()
{
return $this['config']->get('app.name');
}
Taken from:
/**
* Get the current application locale.
*
* #return string
*/
public function getLocale()
{
return $this['config']->get('app.locale');
}
Where should I put this, instead of vendor file ofc?
Thanks
You maybe able to extend the Illuminate/Foundation/Application.php
example:
<?php
namespace app\Custom;
class Application extends \Illuminate\Foundation\Application
{
}
for more details, please refer this click here .
Note: Adding your code under vendor files, may lost during the composer update command. So its not advisable to actually add your custom codes there.

doxygen doesnt seem to work well with class_exists-Method

I want to use doxygen for document my PHP-Project (it's a Wordpress Plugin).
To be save, that I do not overwrite a existing class from any other Wordpress Plugin, I use the "class_exist"-Method.
But now, doxygen is only generate a documentation for my class, if i do any php call before my class definition.
An example:
/**
* #author schmitt
*
* #file my_util_class.php
*
* #class my_util_class
*
* #brief small message
*
* big message
*/
if ( ! class_exists( 'my_util_class' ) ) :
//echo "hallo";
class my_util_class
{
/**
* #brief smalltest
* bigtestmessage
*/
public function test() {
return "hallo";
}
//definition of other methods.
}
endif;
if i comment out the line echo "hallo" doxygen will generate a fully documentation of my class with all Methods.
But if the line is commented, only the header (defined with #file etc.) will documented well. None of the methods is going to be documented.
I have set the "Extract All" Parameter in the doxygen-Config to YES.
But this doesn't help.
Hope someone can help me. Thanks.

PHPDoc using #method to declare magic method and #see to pick documentation from another method

What I want is that when I declare a magic method with #method PHPDoc, can i use #see so that the magic method has the same PHPDoc as the method pointed via #see
Here is the code of what I have tried. But IDE did not recognize it. I am using Netbeans 7.3.1.
/**
* #method string my_method() #see _my_method()
*/
class Foo {
public __call($name, $args) {
$name = "_".$name;
$this->$name($args);
}
/**
* #return String
*/
protected _my_method() {
return "bar";
}
}
The exact parsing will depend on which IDE you're using, but the PHPDocumentor documentation for #see shows a couple of differences from your usage:
The #see tag is on its own line, not appended to the line before. #link has a separate "inline" syntax if you want to include a cross-reference inside a description ({#link http://example.com/my/bar}).
The "target" should be a fully qualified element name, not just the local method name, e.g. #see Foo::_my_method()
There is also a draft PSR to standardise the behaviour, with similar requirements.
I would like to create links to "other" methods to, and I tried #see, #link and lots of other stuff, without any helpfull results.
In phpstorm everything is yust displayed as text.
BUT:
I discovered, that you can write own html-code, so
e.g.
/**
* #method string my_method() see _my_method()
*/
class Foo {
}
would work to create links on external pages.
Unfortunally it only works for external links, and not for links to methods in your editor.

Is there a way to tell PHPStorm to hide a method/function/variable/etc

I'm looking for a way to make PHPStorm hide some methods from code completion. I've tried to annotate the DocBlocks with #access private but that does not hide them from view.
Is there any way to hide private API, short of writing/generating a stub file with a limited interface and referencing that in my project?
for example:
Lets say the library has this in it:
<?php
interface IDoABunchOfStuff
{
/**
* My library users use this
*/
public function doFoo();
/**
* My Library needs this but requires that my users don't see it.
*
* #access private
* #visibility none
* #package mylib
* #internal
*/
public function doBar();
}
class Foo extends Something implements IDoABunchOfStuff
{
/**
* does foo
*/
public function doFoo()
{
// ...
}
/**
* does bar. for internal use only
*
* #access private
* #visibility none
* #package mylib
* #internal
*/
public function _doBar()
{
// ...
}
}
And my library user is typing:
<?php
myAwesomeFunction(IDoABunchOfStuff $aFoo)
{
if($->$oFoo->[CTRL+SPACE] // invoking code completion...
Is it possible to (and if it is how do I) make it so that my user never sees _doBar?
Neither of the different annotations i've tried seem to have the desired effect.
P.S. I'm using PHPStorm 4.0.3
additional:
In this case I am implementing ArrayAccess and I don't want offsetGet, offsetSet, offsetExists and offsetUnset cluttering up my code completion window but I've had similar problems elsewhere enough to warrant asking a more generalized question.
Nope -- you cannot do such thing in current version of PhpStorm.
There is a ticket on Issue Tracker that suggests using #access tag for this purpose, but currently it is not scheduled to be implemented for any particular version: http://youtrack.jetbrains.com/issue/WI-5788
Feel free to vote/comment/etc and maybe it will be implemented sooner.

Doxygen+PHP link to other class member

I'm documenting a PHP project with Doxygen instead of phpDocs because the project involves COCOA programming so I decide to use a common documentation tool.
I have no problem linking to other class methods using the syntax ClassName::method name()
but I get no link when trying to reach a class member in another class, be it public or private with the syntax ClassName::varName.
In one file.
class A {
/**
* A Member
*/
private $a;
/**
* A method
*/
public myMethod(){}
}
In other file.
/**
* Doxygen block
*
* This link is not working!!
* A::a
* This one the same!
* A::$a
*
* This link is working:
* A::myMethod().
*/
UPDATED:
It's working now, the syntax ClassName::varNameis now working. Can't tell what was wrong before so sorry for this useless question. I will mark it as answered as soon as the system allows me to answer my own question.

Categories