PluginProbe
Packeta / 1.6.1
Packeta v1.6.1
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / deps / nette / php-generator / src / PhpGenerator / Traits / AttributeAware.php

AttributeAware.php in Packeta 1.6.1, at deps/nette/php-generator/src/PhpGenerator/Traits/AttributeAware.php

41 lines 935 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * This file is part of the Nette Framework (https://nette.org)
5 * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6 */
7 declare (strict_types=1);
8 namespace Packetery\Nette\PhpGenerator\Traits;
9
10 use Packetery\Nette\PhpGenerator\Attribute;
11 /**
12 * @internal
13 */
14 trait AttributeAware
15 {
16 /** @var Attribute[] */
17 private $attributes = [];
18 /** @return static */
19 public function addAttribute(string $name, array $args = []) : self
20 {
21 $this->attributes[] = new Attribute($name, $args);
22 return $this;
23 }
24 /**
25 * @param Attribute[] $attrs
26 * @return static
27 */
28 public function setAttributes(array $attrs) : self
29 {
30 (function (Attribute ...$attrs) {
31 })(...$attrs);
32 $this->attributes = $attrs;
33 return $this;
34 }
35 /** @return Attribute[] */
36 public function getAttributes() : array
37 {
38 return $this->attributes;
39 }
40 }
41