for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace linkprofit\AmoCRM\entities;
use linkprofit\AmoCRM\traits\FieldList;
/**
* Class BaseEntity
* @package entities
*/
abstract class BaseEntity implements EntityInterface
{
* @var integer id сущности
public $id;
* @var string Дата и время создания сущности
public $created_at;
* @var string Дата и время изменения сущности
public $updated_at;
* @var integer id пользователя ответственного за сущность
public $responsible_user_id;
* @var array
protected $fieldList = [];
use FieldList;
* @return array
public function get()
if ($this->id) {
$this->setUpdatedTime();
}
$fields = $this->getExistedValues($this->fieldList);
return $fields;
* @param $array
public function set($array)
$this->setFromArray($this->fieldList, $array);
* Задаем время обновления, если уже не задано
protected function setUpdatedTime()
if (!$this->updated_at) {
$this->updated_at = time();
$updated_at
string
time()
integer
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42; $correct = false; $correct = (bool) $answer;
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.