sixth
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
* @property string $countryCode
|
||||
* @property string $phoneNumber
|
||||
* @property string $email
|
||||
* @property string $tempString
|
||||
*/
|
||||
class Information
|
||||
{
|
||||
@ -20,8 +21,7 @@ class Information
|
||||
public string $countryCode;
|
||||
public string $phoneNumber;
|
||||
public string $email;
|
||||
|
||||
//public $gender;
|
||||
public string $tempString;
|
||||
|
||||
|
||||
public function __construct()
|
||||
@ -66,12 +66,26 @@ class Information
|
||||
public function toString(): string
|
||||
{
|
||||
return $this->surname . ';' . $this->name . ';' . $this->patronymic . ';' . $this->dateOfBirth . ';' .
|
||||
$this->gender . ';' . $this->countryCode . ';' . $this->phoneNumber . ';' . $this->email . "\n";
|
||||
$this->gender . ';' . $this->countryCode . ';' . $this->phoneNumber . ';' . $this->email . ";\n";
|
||||
}
|
||||
|
||||
public function search()
|
||||
/**
|
||||
* @param array $textArrayFromFile
|
||||
* @param string $search
|
||||
* @return string|null
|
||||
*/
|
||||
public function search(array $textArrayFromFile, string $search): ?string
|
||||
{
|
||||
if($textArrayFromFile) {
|
||||
foreach ($textArrayFromFile as $str) {
|
||||
if (str_contains($str, $search)) {
|
||||
$this->tempString = strstr($str, $search);
|
||||
return substr($this->tempString, 0, strlen($search));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user