-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathPHPFunctionLine.php
More file actions
45 lines (34 loc) · 837 Bytes
/
PHPFunctionLine.php
File metadata and controls
45 lines (34 loc) · 837 Bytes
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
<?php
namespace DrupalCodeBuilder\Generator;
use DrupalCodeBuilder\Definition\PropertyDefinition;
/**
* Generator class for a function line.
*/
class PHPFunctionLine extends BaseGenerator {
/**
* {@inheritdoc}
*/
public static function getPropertyDefinition(): PropertyDefinition {
$definition = parent::getPropertyDefinition();
$definition->addProperties([
// The line of code, without function indentation.
'code' => PropertyDefinition::create('string')
->setRequired(TRUE),
]);
return $definition;
}
/**
* {@inheritdoc}
*/
public function getContentType(): string {
return 'line';
}
/**
* {@inheritdoc}
*/
public function getContents(): array {
$contents = [];
$contents[] = $this->component_data->code->value;
return $contents;
}
}