-
-
Notifications
You must be signed in to change notification settings - Fork 122
Added ApiRenderer::renderDefaultValue, fixed #38
#122
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,7 +247,7 @@ public function renderPropertySignature($property, $context = null) | |
| return '<span class="signature-defs">' . implode(' ', $definition) . '</span> ' | ||
| . '<span class="signature-type">' . $this->createTypeLink($property->types, $context) . '</span>' | ||
| . ' ' . $this->createSubjectLink($property, $property->name) . ' ' | ||
| . ApiMarkdown::highlight('= ' . ($property->defaultValue === null ? 'null' : $property->defaultValue), 'php'); | ||
| . ApiMarkdown::highlight('= ' . $this->renderDefaultValue($property->defaultValue), 'php'); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -262,7 +262,7 @@ public function renderMethodSignature($method, $context = null) | |
| . ($param->isPassedByReference ? '<b>&</b>' : '') | ||
| . ApiMarkdown::highlight( | ||
| $param->name | ||
| . ($param->isOptional ? ' = ' . $param->defaultValue : ''), | ||
| . ($param->isOptional ? ' = ' . $this->renderDefaultValue($param->defaultValue) : ''), | ||
| 'php' | ||
| ); | ||
| } | ||
|
|
@@ -283,6 +283,33 @@ public function renderMethodSignature($method, $context = null) | |
| . str_replace(' ', ' ', ' ( ' . implode(', ', $params) . ' )'); | ||
| } | ||
|
|
||
| /** | ||
| * @param mixed $value | ||
| * @return string | ||
| */ | ||
| public function renderDefaultValue($value) | ||
| { | ||
| if ($value===null) { | ||
| return 'null'; | ||
| } | ||
|
|
||
| static $specials = [ | ||
| '420' => '0644', | ||
| '436' => '0664', | ||
| '438' => '0666', | ||
| '493' => '0755', | ||
| '509' => '0775', | ||
| '511' => '0777', | ||
| '2113696' => '0x2040A0', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, maybe a comment should point to where it is used :) |
||
| '16777215' => '0xFFFFFF', | ||
| ]; | ||
| if (isset($specials[$value])) { | ||
| return $specials[$value]; | ||
| } | ||
|
|
||
| return $value; | ||
| } | ||
|
|
||
| /** | ||
| * @inheritdoc | ||
| */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should also cover
0666,0664,0644,0777and0755.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added