Last active
June 20, 2018 14:47
-
-
Save young-steveo/1de63da3880a35d692b03d49df188619 to your computer and use it in GitHub Desktop.
Array Oriented Programming
This file contains hidden or 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
<?php | |
final class User extends Requester { | |
public function search(array $params) : array { | |
if (empty($params["username"])) { | |
throw new \Exception("Username is required."); | |
} | |
if (empty($params["name"])) { | |
$first = $params["first_name"] ?? ''; | |
$last = $params["last_name"] ?? ''; | |
$params["name"] = "$first $last"; | |
} | |
return $this->request($params)->toArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment