These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @package elemental |
||
5 | */ |
||
6 | class ElementContact extends BaseElement |
||
7 | { |
||
8 | |||
9 | private static $db = array( |
||
10 | 'ContactName' => 'Varchar(255)', |
||
11 | 'Phone' => 'Varchar(100)', |
||
12 | 'Mobile' => 'Varchar(100)', |
||
13 | 'Fax' => 'Varchar(100)', |
||
14 | 'Email' => 'Varchar(255)', |
||
15 | 'Website' => 'Varchar(255)', |
||
16 | ); |
||
17 | |||
18 | private static $extensions = array( |
||
19 | 'Addressable', |
||
20 | 'Geocodable' |
||
21 | ); |
||
22 | |||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private static $title = "Contact Element"; |
||
27 | |||
28 | /** |
||
29 | * @return FieldList |
||
30 | */ |
||
31 | public function getCMSFields() |
||
32 | { |
||
33 | $this->beforeUpdateCMSFields(function ($fields) { |
||
34 | $fields->addFieldsToTab('Root.Main', array( |
||
35 | Textfield::create('ContactName', 'Name'), |
||
36 | TextField::create('Phone', 'Phone'), |
||
37 | TextField::create('Mobile', 'Mobile'), |
||
38 | TextField::create('Fax', 'Fax'), |
||
39 | EmailField::create('Email', 'Email'), |
||
40 | $website = TextField::create('Website', 'Website') |
||
41 | )); |
||
42 | |||
43 | $website->setRightTitle('e.g '.Director::absoluteBaseURL()); |
||
44 | }); |
||
45 | |||
46 | return parent::getCMSFields(); |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Return the obfuscated email. |
||
51 | * |
||
52 | * @return string |
||
0 ignored issues
–
show
|
|||
53 | */ |
||
54 | public function ObfuscatedEmail() |
||
55 | { |
||
56 | return ($this->Email) ? Email::obfuscate($this->Email, 'hex') : null; |
||
57 | } |
||
58 | } |
||
59 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.