-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29fb877
commit cdfd597
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace IdeHelper\ValueObject; | ||
|
||
/** | ||
* Helps to use an existing argument set to be used in other directives for DRY code. | ||
* | ||
* Then it can be used in other places as argumentsSet('mySet'). | ||
* | ||
* @see https://www.jetbrains.com/help/phpstorm/ide-advanced-metadata.html#arguments-set | ||
*/ | ||
class ArgumentsSet implements ValueObjectInterface { | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected $value; | ||
|
||
/** | ||
* @param string $value | ||
*/ | ||
private function __construct(string $value) { | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* Creates itself from a string. | ||
* | ||
* @param string $value | ||
* | ||
* @return static | ||
*/ | ||
public static function create(string $value) { | ||
return new static($value); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function raw(): string { | ||
return $this->value; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function __toString(): string { | ||
return 'argumentsSet(\'' . $this->value . '\')'; | ||
} | ||
|
||
} |