<?php
namespace Modules\Partners\Customers\Deduplicate\Model\Comparer; class ComplexStrict extends AbstractComparer { public function compare() { $this->scoreKeeper->append(50, strcasecmp($this->c1->lastName, $this->c2->lastName)===0 && strcasecmp($this->c1->firstName, $this->c2->firstName)===0, ['firstName', 'lastName'], "firstName and lastName is the same"); if ($this->c1->middleName || $this->c2->middleName) { $this->scoreKeeper->append(5, strcasecmp($this->c1->middleName, $this->c2->middleName)===0, ['middleName', ], "middleName is the same"); } if ($this->c1->idCorporate && $this->c2->idCorporate) { $this->scoreKeeper->append(15, $this->c1->idCorporate==$this->c2->idCorporate, ['idCorporate'], "idCorporate is the same"); } elseif ($this->c1->idCorporate || $this->c2->idCorporate) { $this->scoreKeeper->append( 5, $this->c1->idCorporate==$this->c2->idCorporate, ['idCorporate'], "idCorporate is the same"); } if ($this->c1->title && $this->c2->title) { $this->scoreKeeper->append(10, $this->c1->title==$this->c2->title, ['title'], "title is the same"); } if ($this->c1->type && $this->c2->type) { $this->scoreKeeper->append( 5, $this->c1->type==$this->c2->type, ['type'], "type is the same"); } $this->scoreKeeper->append(0.10, (bool)$this->c1->birthday, ['birthday'], "c1.birthday is set"); $this->scoreKeeper->append(0.10, (bool)$this->c2->birthday, ['birthday'], "c2.birthday is set"); if ($this->c1->birthday && $this->c2->birthday) { $this->scoreKeeper->append(50, $this->c1->birthday==$this->c2->birthday, ['birthday'], "birthday is the same"); } if ($this->c1->PNC && $this->c2->PNC && $this->c1->PNC != $this->c2->PNC) { $this->scoreKeeper->append(500, 0, ['PNC'], "PNC is the same"); } if ($this->c1->ID_number && $this->c2->ID_number) { $this->scoreKeeper->append(500, $this->c1->ID_number==$this->c2->ID_number, ['ID_number'], "ID_number is the same"); } $this->scoreKeeper->append(0.10, (bool)$this->c1->zipCode, ['zipCode'], "c1.zipCode is set"); $this->scoreKeeper->append(0.10, (bool)$this->c2->zipCode, ['zipCode'], "c2.zipCode is set"); if ($this->c1->zipCode && $this->c2->zipCode) { $this->scoreKeeper->append(15, $this->c1->zipCode==$this->c2->zipCode, ['zipCode'], "zipCode is the same"); } $this->scoreKeeper->append(0.10, (bool)$this->c1->cityId, ['cityId'], "c1.cityId is set"); $this->scoreKeeper->append(0.10, (bool)$this->c2->cityId, ['cityId'], "c2.cityId is set"); if ($this->c1->cityId && $this->c2->cityId) { $this->scoreKeeper->append(10, $this->c1->cityId==$this->c2->cityId, ['cityId'], "cityId is the same"); } $this->scoreKeeper->append(0.10, (bool)$this->c1->countryCode, ['countryCode'], "c1.countryCode is set"); $this->scoreKeeper->append(0.10, (bool)$this->c2->countryCode, ['countryCode'], "c2.countryCode is set"); if ($this->c1->countryCode && $this->c2->countryCode) { $this->scoreKeeper->append(5, $this->c1->countryCode==$this->c2->countryCode, ['countryCode'], "countryCode is the same"); } return $this; } } 