-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathComment.php
More file actions
42 lines (35 loc) · 1004 Bytes
/
Comment.php
File metadata and controls
42 lines (35 loc) · 1004 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
<?php
declare(strict_types=1);
namespace Flowpack\NodeTemplates\Domain\NodeTemplateDumper;
use Neos\Flow\Annotations as Flow;
/**
* Wrapper around a comment render function
* {@see Comments}
*
* @Flow\Proxy(false)
*/
class Comment
{
/**
* @var \Closure(string $indentation, string $propertyName): string $renderFunction
*/
private \Closure $renderFunction;
/**
* @param \Closure(string $indentation, string $propertyName): string $renderFunction
*/
private function __construct(\Closure $renderFunction)
{
$this->renderFunction = $renderFunction;
}
/**
* @param \Closure(string $indentation, string $propertyName): string $renderFunction
*/
public static function fromRenderer($renderFunction): self
{
return new self($renderFunction);
}
public function toYamlComment(string $indentation, string $propertyName): string
{
return ($this->renderFunction)($indentation, $propertyName);
}
}