Definition at line 28 of file ChangeLicenseHeader.php.
◆ __construct()
ILIAS\CI\Rector\ChangeLicenseHeader::__construct |
( |
| ) |
|
Definition at line 60 of file ChangeLicenseHeader.php.
62 $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 68 of file ChangeLicenseHeader.php.
71 Node\Stmt\Class_::class,
72 Node\Stmt\Interface_::class,
73 Node\Stmt\Trait_::class
◆ getRuleDefinition()
ILIAS\CI\Rector\ChangeLicenseHeader::getRuleDefinition |
( |
| ) |
|
Definition at line 120 of file ChangeLicenseHeader.php.
122 return new RuleDefinition(
123 'Adds or replaces a license-header in each class-file',
◆ refactor()
ILIAS\CI\Rector\ChangeLicenseHeader::refactor |
( |
Node |
$node | ) |
|
- Parameters
-
Definition at line 80 of file ChangeLicenseHeader.php.
References ILIAS\CI\Rector\ChangeLicenseHeader\filterComments().
82 if (preg_match(self::IGNORE_SUBPATHS, $this->file->getSmartFileInfo()->getPathname()) > 0) {
87 $previous = $node->getAttribute(AttributeKeys::PREVIOUS_NODE);
88 while (is_object($previous) && in_array(get_class($previous), $this->previous_search)) {
89 if ($previous instanceof \PhpParser\Node\Name) {
90 $previous = $previous->getAttribute(AttributeKeys::PARENT_NODE);
93 $current->setAttribute(
94 AttributeKeys::COMMENTS,
97 $previous = $current->getAttribute(AttributeKeys::PREVIOUS_NODE);
100 $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\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: