Conditions | 10 |
Paths | 7 |
Total Lines | 17 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
42 | protected function validateProperties(): void |
||
43 | { |
||
44 | if ($this->implicit && null === $this->implicit->getAuthorizationUrl()) { |
||
45 | throw new OAuthRequiresAuthorizationUrl(); |
||
46 | } |
||
47 | if ($this->password && null === $this->password->getTokenUrl()) { |
||
48 | throw new OAuthRequiresTokenUrl(); |
||
49 | } |
||
50 | if ($this->clientCredentials && $this->clientCredentials->getTokenUrl()) { |
||
51 | throw new OAuthRequiresTokenUrl(); |
||
52 | } |
||
53 | if ($this->authorizationCode) { |
||
54 | if (null === $this->authorizationCode->getAuthorizationUrl()) { |
||
55 | throw new OAuthRequiresAuthorizationUrl(); |
||
56 | } |
||
57 | if (null === $this->authorizationCode->getTokenUrl()) { |
||
58 | throw new OAuthRequiresTokenUrl(); |
||
59 | } |
||
63 |