for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Pixelpeter\Genderize\Models;
class Name extends BaseModel
{
protected $gender;
protected $name;
protected $probability;
protected $count;
/**
* Create new instance of Name model
*/
public function __construct($data)
$data = $this->prepareData($data);
$this->name = $data->name;
$this->gender = $data->gender;
$this->probability = $data->probability;
$this->count = $data->count;
}
* Merge data with default so every field is available
*
* @return object
protected function prepareData($data)
$default = new \StdClass;
$default->name = null;
$default->gender = null;
$default->probability = null;
$default->count = null;
return (object) array_merge(
(array) $default,
(array) $data
);
* Check if name is male
* @return bool
public function isMale()
return $this->gender === 'male';
* Check if name is not male
public function isNotMale()
return $this->gender !== 'male';
* Check if name is female
public function isFemale()
return $this->gender === 'female';
* Check if name is not female
public function isNotFemale()
return $this->gender !== 'female';