Definition at line 28 of file ChangeLicenseHeader.php.
◆ __construct()
| ILIAS\CI\Rector\ChangeLicenseHeader::__construct |
( |
| ) |
|
Definition at line 63 of file ChangeLicenseHeader.php.
65 $this->standard_comment =
new Comment($this->license_header_default);
◆ filterComments()
| ILIAS\CI\Rector\ChangeLicenseHeader::filterComments |
( |
Node |
$node, |
|
|
array |
$default = [] |
|
) |
| |
|
private |
◆ getNodeTypes()
| ILIAS\CI\Rector\ChangeLicenseHeader::getNodeTypes |
( |
| ) |
|
- Returns
- class-string[]
Definition at line 71 of file ChangeLicenseHeader.php.
74 Node\Stmt\Class_::class,
75 Node\Stmt\Interface_::class,
76 Node\Stmt\Trait_::class
◆ getRuleDefinition()
| ILIAS\CI\Rector\ChangeLicenseHeader::getRuleDefinition |
( |
| ) |
|
Definition at line 125 of file ChangeLicenseHeader.php.
127 return new RuleDefinition(
128 'Adds or replaces a license-header in each class-file',
◆ refactor()
| ILIAS\CI\Rector\ChangeLicenseHeader::refactor |
( |
Node |
$node | ) |
|
- Parameters
-
Definition at line 83 of file ChangeLicenseHeader.php.
References ILIAS\CI\Rector\ChangeLicenseHeader\filterComments().
85 if (preg_match(self::IGNORE_SUBPATHS, $this->file->getFilePath()) > 0) {
90 $previous = $node->getAttribute(AttributeKeys::PREVIOUS_NODE);
91 while (is_object($previous) && in_array($previous::class, $this->previous_search)) {
92 if ($previous instanceof \PhpParser\Node\Name) {
93 $previous = $previous->getAttribute(AttributeKeys::PARENT_NODE);
95 if ($previous instanceof Node\Expr\Empty_) {
96 $this->removeNode($previous);
99 $current->setAttribute(
100 AttributeKeys::COMMENTS,
103 $previous = $current->getAttribute(AttributeKeys::PREVIOUS_NODE);
106 $current->setAttribute(AttributeKeys::COMMENTS, $this->
filterComments($current, [$this->standard_comment]));
◆ $license_header_default
| string ILIAS\CI\Rector\ChangeLicenseHeader::$license_header_default |
|
private |
Initial value:= "/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
*
* ILIAS is licensed with the GPL-3.0,
* see https://www.gnu.org/licenses/gpl-3.0.en.html
* You should have received a copy of said license along with the
* source code, too.
*
* If this is not the case or you just want to try ILIAS, you'll find
* us at:
* https://www.ilias.de
* https://github.com/ILIAS-eLearning
*
*********************************************************************/
"
Definition at line 32 of file ChangeLicenseHeader.php.
◆ $previous_search
| array ILIAS\CI\Rector\ChangeLicenseHeader::$previous_search |
|
private |
Initial value:= [
Node\Stmt\If_::class,
Node\Expr\Empty_::class,
Node\Stmt\Global_::class,
Node\Expr\Include_::class,
Node\Stmt\Use_::class,
Node\Stmt\Namespace_::class,
Node\Name::class,
Node\Stmt\Class_::class,
Node\Stmt\Expression::class,
Node\Stmt\Declare_::class,
]
Definition at line 50 of file ChangeLicenseHeader.php.
◆ $standard_comment
| Comment ILIAS\CI\Rector\ChangeLicenseHeader::$standard_comment |
|
private |
◆ EXISTING_LICENSE_PATTERN
| const ILIAS\CI\Rector\ChangeLicenseHeader::EXISTING_LICENSE_PATTERN = '(copyright|Copyright|GPL-3\.0|GPLv3|LICENSE)' |
◆ IGNORE_SUBPATHS
| const ILIAS\CI\Rector\ChangeLicenseHeader::IGNORE_SUBPATHS = '(lib|vendor|data|Customizing)' |
The documentation for this class was generated from the following file: