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:
8: namespace Nette\PhpGenerator\Traits;
9:
10: use Nette;
11:
12:
13: /**
14: * @internal
15: */
16: trait VisibilityAware
17: {
18: /** @var string|null public|protected|private */
19: private $visibility;
20:
21:
22: /**
23: * @param string|null public|protected|private
24: * @return static
25: */
26: public function setVisibility($val)
27: {
28: if (!in_array($val, ['public', 'protected', 'private', null], true)) {
29: throw new Nette\InvalidArgumentException('Argument must be public|protected|private.');
30: }
31: $this->visibility = $val;
32: return $this;
33: }
34:
35:
36: /**
37: * @return string|null
38: */
39: public function getVisibility()
40: {
41: return $this->visibility;
42: }
43: }
44: