PluginProbe
WPIDE – File Manager & Code Editor / 3.5.9
WPIDE – File Manager & Code Editor v3.5.9
3.5.9 3.5.8 3.5.7 2.0.14 2.0.15 2.0.16 2.0.2 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1 2.2 2.3 2.3.1 2.3.2 2.4.0 2.5 2.6 3.0 3.1 3.2 3.3 All 55 releases
wpide / vendor / nikic / php-parser / lib / PhpParser / Builder / Use_.php

Use_.php in WPIDE – File Manager & Code Editor 3.5.9, at vendor/nikic/php-parser/lib/PhpParser/Builder/Use_.php

50 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace PhpParser\Builder;
4
5 use PhpParser\Builder;
6 use PhpParser\BuilderHelpers;
7 use PhpParser\Node;
8 use PhpParser\Node\Stmt;
9
10 class Use_ implements Builder
11 {
12 protected $name;
13 protected $type;
14 protected $alias = null;
15
16 /**
17 * Creates a name use (alias) builder.
18 *
19 * @param Node\Name|string $name Name of the entity (namespace, class, function, constant) to alias
20 * @param int $type One of the Stmt\Use_::TYPE_* constants
21 */
22 public function __construct($name, int $type) {
23 $this->name = BuilderHelpers::normalizeName($name);
24 $this->type = $type;
25 }
26
27 /**
28 * Sets alias for used name.
29 *
30 * @param string $alias Alias to use (last component of full name by default)
31 *
32 * @return $this The builder instance (for fluid interface)
33 */
34 public function as(string $alias) {
35 $this->alias = $alias;
36 return $this;
37 }
38
39 /**
40 * Returns the built node.
41 *
42 * @return Stmt\Use_ The built node
43 */
44 public function getNode() : Node {
45 return new Stmt\Use_([
46 new Stmt\UseUse($this->name, $this->alias)
47 ], $this->type);
48 }
49 }
50