-
-
Notifications
You must be signed in to change notification settings - Fork 438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP - Add wildcard to inject directive #2280
Draft
andershagbard
wants to merge
27
commits into
nuwave:master
Choose a base branch
from
andershagbard:inject-wildcard
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
eedb6ea
WIP - Add wildcard to inject directive
andershagbard 78a92ce
Insert lang doc
andershagbard 7226a09
Finish test
andershagbard acb91bb
Add type
andershagbard 5f1c74b
Rename method
andershagbard b607c28
Improve docs
andershagbard 8ff0340
Update def
andershagbard 8b4ffec
Update CHANGELOG.md
andershagbard eea6145
Update src/Schema/Directives/InjectDirective.php
andershagbard d20a332
Throw error if not array
andershagbard 60f8834
Update docs
andershagbard e163ae7
Change typo
andershagbard 4a49468
Update example
andershagbard 4fc5b9c
Update docs/master/api-reference/directives.md
andershagbard 95299b0
Add test case with non array target
andershagbard 86ee821
Implement ArrayAccess and use data_set
andershagbard 9f17d55
Merge branch 'inject-wildcard' of https://github.com/andershagbard/li…
andershagbard 503347c
Implement ArrayAccess
andershagbard 3ae756e
Set new self if empty value
andershagbard 7bb4ffb
Add IteratorAggregate
andershagbard 36e3e0e
Remove check
andershagbard d0a1cd7
Remove method
andershagbard 829172f
Add failing test case
andershagbard a42c22e
Revert "Add failing test case"
andershagbard 42b907c
Fix test
andershagbard a0e55d8
Update
andershagbard ead7514
Fix
andershagbard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ | |||||||||
|
||||||||||
use Illuminate\Support\Collection; | ||||||||||
|
||||||||||
class Argument | ||||||||||
class Argument implements \ArrayAccess, \IteratorAggregate | ||||||||||
{ | ||||||||||
/** | ||||||||||
* The value given by the client. | ||||||||||
|
@@ -85,4 +85,42 @@ protected static function toPlainRecursive($value) | |||||||||
|
||||||||||
return $value; | ||||||||||
} | ||||||||||
|
||||||||||
public function offsetExists(mixed $offset): bool | ||||||||||
{ | ||||||||||
$argument = $this; | ||||||||||
|
||||||||||
return isset($argument->value[$offset]); | ||||||||||
} | ||||||||||
|
||||||||||
public function &offsetGet(mixed $offset): mixed | ||||||||||
{ | ||||||||||
$argument = $this; | ||||||||||
|
||||||||||
return $argument->value[$offset]; | ||||||||||
} | ||||||||||
|
||||||||||
public function offsetSet(mixed $offset, mixed $value): void | ||||||||||
{ | ||||||||||
$argument = $this; | ||||||||||
|
||||||||||
$argumentSet = new ArgumentSet(); | ||||||||||
$argumentSet[(string) $offset] = $value; | ||||||||||
|
||||||||||
$argument->value = $argumentSet; | ||||||||||
} | ||||||||||
|
||||||||||
public function offsetUnset(mixed $offset): void | ||||||||||
{ | ||||||||||
$argument = $this; | ||||||||||
|
||||||||||
unset($argument[$offset]); | ||||||||||
} | ||||||||||
|
||||||||||
public function getIterator(): \ArrayIterator | ||||||||||
{ | ||||||||||
$value = $this->value; | ||||||||||
|
||||||||||
return new \ArrayIterator($value); | ||||||||||
Comment on lines
+122
to
+124
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
} | ||||||||||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not get why you keep aliasing
$this
- why not just it directly?