public function identifyModel($pattern, $subject, $defaults = [])
{
if (preg_match($pattern, $subject, $match)) {
$this->manufacturer = !empty($defaults['manufacturer']) ? $defaults['manufacturer'] : null;
$this->model = Data\DeviceModels::cleanup($match[1]);
$this->identifier = preg_replace('/ (Mozilla|Opera|Obigo|AU.Browser|UP.Browser|Build|Java|PPC|AU-MIC.*)$/iu', '', $match[0]);
$this->identifier = preg_replace('/_(TD|GPRS|LTE|BLEU|CMCC|CUCC)$/iu', '', $match[0]);
if (isset($defaults['model'])) {
if (is_callable($defaults['model'])) {
$this->model = call_user_func($defaults['model'], $this->model);
} else {
$this->model = $defaults['model'];
}
}
$this->generic = false;
$this->identified |= Constants\Id::PATTERN;
if (!empty($defaults['carrier'])) {
$this->carrier = $defaults['carrier'];
}
if (!empty($defaults['type'])) {
$this->type = $defaults['type'];
}
}
}