Completed
Pull Request — 2.x (#43)
by jake
02:49 queued 50s
created

Form::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1.008

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 12
ccs 4
cts 5
cp 0.8
rs 9.4285
cc 1
eloc 8
nc 1
nop 1
crap 1.008
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\Html\Helper;
10
11
/**
12
 *
13
 * Helper to generate an opening form tag.
14
 *
15
 * @package Aura.Html
16
 *
17
 */
18
class Form extends AbstractHelper
19
{
20
    /**
21
     *
22
     * Helper to generate an opening form tag.
23
     *
24
     * @param array $attr Attributes for the form tag.
25
     *
26
     * @return string
27
     *
28
     */
29 1
    public function __invoke(array $attr = array())
30
    {
31
        $base = array(
32
            'id' => null,
33
            'method' => 'post',
34
            'action' => null,
35
            'enctype' => 'multipart/form-data',
36 1
        );
37
38
        $attr = $this->escaper->attr(array_merge($base, $attr));
39 1
        return "<form $attr>";
40 1
    }
41
}
42