Skip to content

Commit

Permalink
Added clanSearch method
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFiregore authored Jan 7, 2018
1 parent 009f14e commit 19c02fa
Showing 1 changed file with 120 additions and 8 deletions.
128 changes: 120 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ This are the steps to obtain it:
<?php
use CR\Api;
require 'vendor/autoload.php';
/**
/**
* Return all the information about the given users tag
* @method getPlayer
* @param array $player Array with the id of the profiles
* @return array|Player Array of Player Objects if given more than one profile, else return one Player Object
* @param array $player Array with the id of the profiles
* @param array $keys Array with the exact parameters to request
* @param array $exclude Array with the exact parameters to exclude in the request
* @return Player[] Array of Player Objects if given more than one profile, else return one Player Object
*/
$token = "YOUR_TOKEN";
$api = new Api($token);
Expand All @@ -63,11 +65,11 @@ catch(Exception $e){
use CR\Api;
require 'vendor/autoload.php';
/**
* Return all the information about the given clan tag
* @method getClan
* @param array $clan Array with the tag of the clans
* @return array|Clan Array of Clan Objects if given more than one profile, else return one Clan Object
*/
* Return all the information about the given clan tag
* @method getClan
* @param array $clan Array with the tag of the clans
* @return Clan[] Array of Clan Objects if given more than one profile, else return one Clan Object
*/
$token = "YOUR_TOKEN";
$api = new Api($token);
try{
Expand Down Expand Up @@ -104,3 +106,113 @@ catch(Exception $e){
}
```

## clanSearch
```
<?php
ini_set('max_execution_time', 3000);
use CR\Api;
require '../vendor/autoload.php';
$token = "YOUR_TOKEN";
$api = new Api($token);
try {
/**
* Search clans by their attributes
* @method clanSearch
* @param string $name (Optional)Clan name text search.
* @param int $score (Optional) Minimum clan score.
* @param int $minMembers (Optional) Minimum number of members. 0-50
* @param int $maxMembers (Optional) Maximum number of members. 0-50
* @return ClanSearch[] $clanSearch Returns an array of Clan objects that match the search parameters
*/
$clansSearch = $api->clanSearch("INFRAMUNDO",35140,44,46);
foreach ($clansSearch as $clanSearch) {
/**
* ClanSearch object
*
* @method string getTag() Returns the tag of the clan
* @method string getName() Returns the name of the clan
* @method string getType() Returns the admission type of the clan
* @method int getScore() Returns the score of the clan
* @method int getMemberCount() Returns the members number of the clan
* @method int getRequiredScore() Returns the required score to enter the clan
* @method int getDonations() Returns the total donations per week of the clan
* @method AllianceBadge getBadge() Returns the AllianceBadge Object of the clan
* @method Location getLocation() Returns the Location Object of the clan
*/
$tag = $clanSearch->getTag();
$name = $clanSearch->getName();
$type = $clanSearch->getType();
$score = $clanSearch->getScore();
$memberCount = $clanSearch->getMemberCount();
$requiredScore = $clanSearch->getRequiredScore();
$donations = $clanSearch->getDonations();
/**
* AlianceBadge object
*
*
* @method string getName() Returns the name of the badge
* @method string getCategory() Returns the category name of the badge
* @method int getId() Returns the id of the badge
* @method string getImage() Returns the image url of the badge
*
*
*/
$badge = $clanSearch->getBadge();
$name = $badge->getName();
$category = $badge->getCategory();
$id = $badge->getId();
$image = $badge->getImage();
/**
* Location object
* @method string getName() Returns the name of the location.
* @method bool getIsCountry() Returns true if the location is a country. otherwise returns false.
* @method string getCode() Returns the country/continent code
*
*
* @method string getContinent() Returns the continent name
* @method string getContinentCod() Returns the continent code
* @method string getCountry() Returns the country name
* @method string getCountryCode() Returns the country code
*/
$location = $clanSearch->getLocation();
$country = $location->getCountry();
$continent = $location->getContinent();
$countryCode = $location->getCountryCode();
$continentCode = $location->getContinentCode();
d(
$clanSearch,
$tag,
$name,
$type,
$score,
$memberCount,
$requiredScore,
$donations,
$badge,
$name,
$category,
$id,
$image,
$location,
$country,
$continent,
$countryCode,
$continentCode
);
}
} catch (\Exception $e) {
d($e);
}
```

0 comments on commit 19c02fa

Please sign in to comment.