Skip to content

Conversation

@dongasai
Copy link
Contributor

Add the unRegister method to unRegister

I had a situation in development where I needed to unregister but _options was private so I couldn't unregister, so I added this.

Add the unRegister method to unRegister
@codecov-io
Copy link

codecov-io commented Dec 28, 2020

Codecov Report

Merging #61 (e7757a2) into main (6b65506) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##                main       #61   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
- Complexity       336       337    +1     
===========================================
  Files             16        16           
  Lines            827       830    +3     
===========================================
+ Hits             827       830    +3     
Impacted Files Coverage Δ Complexity Δ
src/Input/Parser.php 100.00% <100.00%> (ø) 36.00 <1.00> (+1.00)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c17fdec...e7757a2. Read the comment docs.

*/
public function unRegister($name)
{
if (isset($this->_values[$name])) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for unset no need to check first with isset.

also multiple unset can be combined

eg: unset($a['key1'], $a['key2']);

@adhocore
Copy link
Owner

thank you very much. please try to get build pass somehow. 👏

@dongasai
Copy link
Contributor Author

dongasai commented Jan 2, 2021

In the https://travis-ci.com/github/adhocore/php-cli/jobs/467713360 mission tasks fail because the configuration error

@adhocore
Copy link
Owner

adhocore commented Jan 4, 2021

thanks, instead of using unregister() method, can we rename it to unset()?

we have register() method with Parameter class as input arg which is not in line with unregister() method with string arg.

@dongasai
Copy link
Contributor Author

dongasai commented Jan 5, 2021

@adhocore .

@adhocore adhocore merged commit 319c7dd into adhocore:main Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants