REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.38 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/rector/rector-doctrine/src/NodeFactory/ValueAssignFactory.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\Doctrine\NodeFactory; use PhpParser\Node\Arg; use PhpParser\Node\Expr; use PhpParser\Node\Expr\Assign; use PhpParser\Node\Expr\New_; use PhpParser\Node\Expr\PropertyFetch; use PhpParser\Node\Expr\Variable; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Scalar\String_; use PhpParser\Node\Stmt\Expression; final class ValueAssignFactory { public function createDefaultDateTimeWithValueAssign(string $propertyName, Expr $defaultExpr) : Expression { $propertyFetch = $this->createPropertyFetch($propertyName); $newDateTime = $this->createNewDateTime(); $this->addDateTimeArgumentIfNotDefault($defaultExpr, $newDateTime); $assign = new Assign($propertyFetch, $newDateTime); return new Expression($assign); } private function createPropertyFetch(string $propertyName) : PropertyFetch { return new PropertyFetch(new Variable('this'), $propertyName); } private function createNewDateTime() : New_ { return new New_(new FullyQualified('DateTime')); } private function addDateTimeArgumentIfNotDefault(Expr $defaultExpr, New_ $dateTimeNew) : void { if ($defaultExpr instanceof String_ && ($defaultExpr->value === 'now' || $defaultExpr->value === 'now()')) { return; } $dateTimeNew->args[] = new Arg($defaultExpr); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 2
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
ArrayCollectionAssignFactory.php
892 B
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ValueAssignFactory.php
1.38 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).