Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP add example tag implementation #1145

Closed
wants to merge 7 commits into from

Conversation

siad007
Copy link
Contributor

@siad007 siad007 commented Mar 9, 2014

@mvriel i just made a rough thought about an implementation of the example tag. i did not notice your heavy changes inside the xml writer so i will make some changes there. in the meantime you could give me a hint if this solution would be helpful and if which changes you see there ad hoc? greetings siad

@mvriel
Copy link
Member

mvriel commented Mar 15, 2014

Hi @siad007,

This looks very promising! I like how you have properly used the Assembler and Descriptors.

Have you looked at http://www.phpdoc.org/docs/latest/references/phpdoc/tags/example.html to see where the tag looks for the example file? I can see that you code only looks in the provided examples folder.

Also: I see duplication between the XML writer and the Twig writer. Perhaps you can solve that by introducing a Compiler pass that inserts the example file's contents into the ExampleDescriptor. That way neither writer needs to know about this business logic and it is really encapsulated into phpDocumentor; what do you think?

$exampleFromConfg = rtrim($this->exampleDir, '\\/') .DIRECTORY_SEPARATOR . $filename;
$source = sprintf('%s%s%s%s%s', getcwd(), DIRECTORY_SEPARATOR, trim($this->sourceDir, '\\/'), DIRECTORY_SEPARATOR, trim($filename, '"'));

$file = @file($exampleFromConfg) ?: @file($source) ?: @file($example) ?: @file($filename);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use nested ternaries; those can be confusing

@mvriel
Copy link
Member

mvriel commented Mar 15, 2014

Awesome stuff!

siad007 added a commit to siad007/ReflectionDocBlock that referenced this pull request Mar 16, 2014
@mvriel
Copy link
Member

mvriel commented Apr 14, 2014

This PR is superceded by #1209; so I am closing this

@mvriel mvriel closed this Apr 14, 2014
mvriel pushed a commit to phpDocumentor/ReflectionDocBlock that referenced this pull request Jun 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants