Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions templates/html/ApiRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand All @@ -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'
);
}
Expand All @@ -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',
Copy link
Member

@cebe cebe Nov 23, 2016

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, 0777 and 0755.

Copy link
Member Author

Choose a reason for hiding this comment

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

added

'511' => '0777',
'2113696' => '0x2040A0',
Copy link
Member

Choose a reason for hiding this comment

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

what is this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

The 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
*/
Expand Down