| Conditions | 9 | 
| Paths | 9 | 
| Total Lines | 102 | 
| Code Lines | 79 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
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 | 	public function shared(array $params) { | 
            ||
| 43 | 		if($params['shareType'] === Share::SHARE_TYPE_LINK) { | 
            ||
| 44 | $this->log(  | 
            ||
| 45 | 'The %s "%s" with ID "%s" has been shared via link with permissions "%s" (Share ID: %s)',  | 
            ||
| 46 | $params,  | 
            ||
| 47 | [  | 
            ||
| 48 | 'itemType',  | 
            ||
| 49 | 'itemTarget',  | 
            ||
| 50 | 'itemSource',  | 
            ||
| 51 | 'permissions',  | 
            ||
| 52 | 'id',  | 
            ||
| 53 | ]  | 
            ||
| 54 | );  | 
            ||
| 55 | 		} elseif($params['shareType'] === Share::SHARE_TYPE_USER) { | 
            ||
| 56 | $this->log(  | 
            ||
| 57 | 'The %s "%s" with ID "%s" has been shared to the user "%s" with permissions "%s" (Share ID: %s)',  | 
            ||
| 58 | $params,  | 
            ||
| 59 | [  | 
            ||
| 60 | 'itemType',  | 
            ||
| 61 | 'itemTarget',  | 
            ||
| 62 | 'itemSource',  | 
            ||
| 63 | 'shareWith',  | 
            ||
| 64 | 'permissions',  | 
            ||
| 65 | 'id',  | 
            ||
| 66 | ]  | 
            ||
| 67 | );  | 
            ||
| 68 | 		} elseif($params['shareType'] === Share::SHARE_TYPE_GROUP) { | 
            ||
| 69 | $this->log(  | 
            ||
| 70 | 'The %s "%s" with ID "%s" has been shared to the group "%s" with permissions "%s" (Share ID: %s)',  | 
            ||
| 71 | $params,  | 
            ||
| 72 | [  | 
            ||
| 73 | 'itemType',  | 
            ||
| 74 | 'itemTarget',  | 
            ||
| 75 | 'itemSource',  | 
            ||
| 76 | 'shareWith',  | 
            ||
| 77 | 'permissions',  | 
            ||
| 78 | 'id',  | 
            ||
| 79 | ]  | 
            ||
| 80 | );  | 
            ||
| 81 | 		} elseif($params['shareType'] === Share::SHARE_TYPE_ROOM) { | 
            ||
| 82 | $this->log(  | 
            ||
| 83 | 'The %s "%s" with ID "%s" has been shared to the room "%s" with permissions "%s" (Share ID: %s)',  | 
            ||
| 84 | $params,  | 
            ||
| 85 | [  | 
            ||
| 86 | 'itemType',  | 
            ||
| 87 | 'itemTarget',  | 
            ||
| 88 | 'itemSource',  | 
            ||
| 89 | 'shareWith',  | 
            ||
| 90 | 'permissions',  | 
            ||
| 91 | 'id',  | 
            ||
| 92 | ]  | 
            ||
| 93 | );  | 
            ||
| 94 | 		} elseif($params['shareType'] === Share::SHARE_TYPE_EMAIL) { | 
            ||
| 95 | $this->log(  | 
            ||
| 96 | 'The %s "%s" with ID "%s" has been shared to the email recipient "%s" with permissions "%s" (Share ID: %s)',  | 
            ||
| 97 | $params,  | 
            ||
| 98 | [  | 
            ||
| 99 | 'itemType',  | 
            ||
| 100 | 'itemTarget',  | 
            ||
| 101 | 'itemSource',  | 
            ||
| 102 | 'shareWith',  | 
            ||
| 103 | 'permissions',  | 
            ||
| 104 | 'id',  | 
            ||
| 105 | ]  | 
            ||
| 106 | );  | 
            ||
| 107 | 		} elseif($params['shareType'] === Share::SHARE_TYPE_CIRCLE) { | 
            ||
| 108 | $this->log(  | 
            ||
| 109 | 'The %s "%s" with ID "%s" has been shared to the circle "%s" with permissions "%s" (Share ID: %s)',  | 
            ||
| 110 | $params,  | 
            ||
| 111 | [  | 
            ||
| 112 | 'itemType',  | 
            ||
| 113 | 'itemTarget',  | 
            ||
| 114 | 'itemSource',  | 
            ||
| 115 | 'shareWith',  | 
            ||
| 116 | 'permissions',  | 
            ||
| 117 | 'id',  | 
            ||
| 118 | ]  | 
            ||
| 119 | );  | 
            ||
| 120 | 		} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE) { | 
            ||
| 121 | $this->log(  | 
            ||
| 122 | 'The %s "%s" with ID "%s" has been shared to the remote user "%s" with permissions "%s" (Share ID: %s)',  | 
            ||
| 123 | $params,  | 
            ||
| 124 | [  | 
            ||
| 125 | 'itemType',  | 
            ||
| 126 | 'itemTarget',  | 
            ||
| 127 | 'itemSource',  | 
            ||
| 128 | 'shareWith',  | 
            ||
| 129 | 'permissions',  | 
            ||
| 130 | 'id',  | 
            ||
| 131 | ]  | 
            ||
| 132 | );  | 
            ||
| 133 | 		} elseif($params['shareType'] === Share::SHARE_TYPE_REMOTE_GROUP) { | 
            ||
| 134 | $this->log(  | 
            ||
| 135 | 'The %s "%s" with ID "%s" has been shared to the remote group "%s" with permissions "%s" (Share ID: %s)',  | 
            ||
| 136 | $params,  | 
            ||
| 137 | [  | 
            ||
| 138 | 'itemType',  | 
            ||
| 139 | 'itemTarget',  | 
            ||
| 140 | 'itemSource',  | 
            ||
| 141 | 'shareWith',  | 
            ||
| 142 | 'permissions',  | 
            ||
| 143 | 'id',  | 
            ||
| 144 | ]  | 
            ||
| 322 |