/**
  * @return Client
  */
 public function toClient()
 {
     $name = $this->getClientName();
     $hasName = $name !== null && strlen($name) > 0;
     $grantTypes = $this->getGrantTypes();
     $clientUri = $this->getClientUri();
     $tosUri = $this->getTosUri();
     $clientName = $this->getClientName();
     $redirectUris = $this->getRedirectUris();
     $client = new Client();
     if ($grantTypes) {
         $client->setAllowedGrantTypes($grantTypes);
     }
     if ($clientUri) {
         $client->setLandingPageUrl($clientUri)->setSiteUrl($clientUri);
     }
     if ($tosUri) {
         $client->setTermsOfUseUrl($tosUri);
     }
     if ($clientName) {
         $client->setName($clientName);
     }
     if ($redirectUris) {
         $client->setRedirectUris($redirectUris);
     }
     $client->setVisible(false)->setPublished(false);
     return $client;
 }