/usr/share/php/kohana3.2/modules/userguide/classes/kohana/kodoc/method/param.php is in libkohana3.2-mod-userguide-php 3.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | <?php defined('SYSPATH') or die('No direct script access.');
/**
* Class method parameter documentation generator.
*
* @package Kohana/Userguide
* @category Base
* @author Kohana Team
* @copyright (c) 2009 Kohana Team
* @license http://kohanaphp.com/license
*/
class Kohana_Kodoc_Method_Param extends Kodoc {
/**
* @var object ReflectionParameter for this property
*/
public $param;
/**
* @var string name of this var
*/
public $name;
/**
* @var string variable type, retrieved from the comment
*/
public $type;
/**
* @var string default value of this param
*/
public $default;
/**
* @var string description of this parameter
*/
public $description;
/**
* @var boolean is the parameter passed by reference?
*/
public $reference = FALSE;
/**
* @var boolean is the parameter optional?
*/
public $optional = FALSE;
public function __construct($method, $param)
{
$this->param = new ReflectionParameter($method, $param);
$this->name = $this->param->name;
if ($this->param->isDefaultValueAvailable())
{
$this->default = Debug::dump($this->param->getDefaultValue());
}
if ($this->param->isPassedByReference())
{
$this->reference = TRUE;
}
if ($this->param->isOptional())
{
$this->optional = TRUE;
}
}
public function __toString()
{
$display = '';
if ($this->type)
{
$display .= '<small>'.$this->type.'</small> ';
}
if ($this->reference)
{
$display .= '<small><abbr title="passed by reference">&</abbr></small> ';
}
if ($this->description)
{
$display .= '<span class="param" title="'.$this->description.'">$'.$this->name.'</span> ';
}
else
{
$display .= '$'.$this->name.' ';
}
if ($this->default)
{
$display .= '<small>= '.$this->default.'</small> ';
}
return $display;
}
} // End Kodoc_Method_Param
|