Example #1
0
/**
 * @type DocBlock
 * Documentation block of a function.
 *
 * @field type String
 * @field name String
 * @field args [Arg]
 * @field return String
 * @field signatures [String]
 * @field description String
 * @field is_internal Boolean
 * @field is_static Boolean
 */
function block($data)
{
    $keywords = keywords($data);
    return (object) ['type' => typeOf($data), 'name' => isset($data->ctx->name) ? $data->ctx->name : F\last($keywords), 'args' => argsOf($data), 'return' => returnOf($data), 'signatures' => signaturesOf($data), 'description' => $data->description->full, 'is_static' => in_array('static', $keywords), 'is_internal' => in_array('private', $keywords) || in_array('protected', $keywords) || 0 < F\length(tags('internal', $data))];
}
Example #2
0
 public function test_length()
 {
     $this->assertEquals(3, F\length([1, 2, 3]));
     $this->assertEquals(5, F\length('Hello'));
 }