Indica si se debe usar el nombre de tipo como clave

@param \PlanB\Type\Data\Data $data

@return bool
775812
protected function hasKeyLikeType(Data $data): bool
    {
        return $data->isScalar() || $data->isConvertibleToString() || $data->isHashable();
    }
695743
public function has_data($data=null)
  {
    if ( \is_null($data) ){
      $data = $this->data;
    }
    return ( \is_array($data) && (\count($data) > 0) ) ? 1 : false;
  }
1284317
public function validate($data = null)
  {
    $this->reset();

    if (!$this->isSent($data)) {
      return false;
    }

    if (!$this->checkCaptcha($data)) {
      $this->addError($this->getErrCaptcha());
    }

    $data = $this->beforeValidation($this->getValuesForValidation($data));

    foreach ($this->fields as $field => $el) {
      $el->validate($data[$field]);
      unset($data[$field]);

      $this->data[$field] = $el->getValue(true);

      if ($err = $el->getErrors()) {
        foreach ($err as $str) {
          $this->addError($str);
        }
      }
    }

    // Если остались доп.поля после предвалидации - переносим к общим данным
    if (!empty($data)) {
      $this->data = array_merge($data, $this->data);
    }

    $this->data = $this->afterValidation($this->data);

    if ($this->isValid()) {
      $this->process();

      return $this->isValid();
    }

    return false;
  }
416585
protected final function validateNewData(array $data = null) {
		if ($data === null && isset($this->_formData)) {
			$data = $this->_formData;
		}
		if ($this->rules) {
			return $this->validateData($this->rules, $data);
		}

		return true;
	}
1169963
public function write($data)
    {
        if (!$this->connected && !$this->connect()) {
            return false;
        }
        $totalBytes = strlen($data);
        $written = 0;
        while ($written < $totalBytes) {
            $rv = fwrite($this->connection, substr($data, $written));
            if ($rv === false || $rv === 0) {
                return $written;
            }
            $written += $rv;
        }

        return $written;
    }
335808
private function isArrayResourceData($data)
    {
        if (!is_array($data) || empty($data)) {
            return false;
        }
        foreach ($data as $datum) {
            if (!$this->isResourceData($datum)) {
                return false;
            }
        }

        return true;
    }
1288111
public function sendData($data)
    {
        $response = $this->braintree->paymentMethod()->delete($data);

        return $this->createResponse($response);
    }
421888
public function put($data)
    {
        if (empty($data) or !is_array($data))
        {
            return false;
        }
        if ($this->db->insert($data, $this->table))
        {
            $lastInsertId = $this->db->lastInsertId();
            if ($lastInsertId == 0)
            {
                return true;
            }
            else
            {
                return $lastInsertId;
            }
        }
        else
        {
            return false;
        }
    }
934405
protected function _checkProvider($data)
    {
        $fields = $this->_config['fields'];

        if (empty($data[$fields['provider']])) {
            return false;
        }

        $provider = $data[$fields['provider']];

        if ($provider === 'OpenID' && empty($data[$fields['openid_identifier']])) {
            return false;
        }

        return $provider;
    }
868048
public function jobCheckNewExtensionVersion($data)
    {
        $config = $this->getConfig();

        if (!$config->get('adminNotifications') || !$config->get('adminNotificationsNewExtensionVersion')) {
            return true;
        }

        $pdo = $this->getEntityManager()->getPDO();

        $query = "
            SELECT id, name, version, check_version_url as url
            FROM extension
            WHERE deleted = 0
            AND is_installed = 1
            ORDER BY created_at
        ";

        $sth = $pdo->prepare($query);
        $sth->execute();

        $rowList = $sth->fetchAll(\PDO::FETCH_ASSOC);

        $latestReleases = [];
        foreach ($rowList as $row) {

            $url = !empty($row['url']) ? $row['url'] : null;
            $extensionName = $row['name'];

            $latestRelease = $this->getLatestRelease($url, [
                'name' => $extensionName,
            ]);

            if (!empty($latestRelease) && !isset($latestRelease['error'])) {
                $latestReleases[$extensionName] = $latestRelease;
            }
        }

        $latestExtensionVersions = $config->get('latestExtensionVersions', []);

        $save = false;
        foreach ($latestReleases as $extensionName => $extensionData) {

            if (empty($latestExtensionVersions[$extensionName])) {
                $latestExtensionVersions[$extensionName] = $extensionData['version'];
                $save = true;
                continue;
            }

            if ($latestExtensionVersions[$extensionName] != $extensionData['version']) {
                $latestExtensionVersions[$extensionName] = $extensionData['version'];

                if (!empty($extensionData['notes'])) {
                    //todo: create notification
                }

                $save = true;
                continue;
            }

            if (!empty($extensionData['notes'])) {
                //todo: find and modify notification
            }
        }

        if ($save) {
            $config->set('latestExtensionVersions', $latestExtensionVersions);
            $config->save();
        }

        return true;
    }
221633
public function check($data)
	{
		$failure  = 0;
		$messages = array();

		if (is_string($data))
		{
			$data = array('text' => $data);
		}

		$data = $this->prepareData($data);

		foreach ($this->detectors as $id => $detector)
		{
			$spam = false;
			$msg  = null;

			try
			{
				if ($detector->detect($data))
				{
					$spam = true;

					if ($detector->message())
					{
						$messages[] = $detector->message();
					}

					$failure++;
				}

				$msg = $detector->message();
			}
			catch (Exception $e)
			{
				$this->setError($e->getMessage());
			}

			$this->mark($id, $spam, $msg);
		}

		$result = new Result($failure > 0, $messages);

		return $result;
	}
1211853
public function deleteData($data) : Bool
    {
        if( is_array($data) ) foreach( $data as $v )
        {
            unset($_SESSION[$this->fix . $v]);
        }
        else
        {
            unset($_SESSION[$this->fix . $data]);
        }

        return true;
    }
150797
protected function insert(Data $data)
    {
        $this->__before('insert', $data);
        $data->validate();

        if (!is_array($id = $this->doInsert($data))) {
            return false;
        }

        $this->pack($id, $data);
        $this->__after('insert', $data);

        return true;
    }
514182
public function update($data)
	{
		$bites = file_put_contents($this->path, $data, LOCK_EX);

		return $bites !== false;
	}
443372
public function correspondsWithCountry($data) {
		if (!empty($entity['postal_code'])) {
			$res = $this->Countries->find('first', [
				'conditions' => ['Country.id' => $entity['country_id']]
			]);
			if (empty($res)) {
				return true;
			}
			if (!empty($res['Country']['zip_length']) && $res['Country']['zip_length'] != mb_strlen($entity['postal_code'])) {
				return false;
			}

		}
		return true;
	}
1346826
public static function sendEmail($data)
    {
        $data = self::setTemplate($data);

        if(isset($data['html']) && isset($data['text']))
        {
            Mail::send(['pulsar::common.views.html_display', 'pulsar::common.views.text_display'], $data, function ($message) use ($data) {
                $message->to($data['email'], $data['name'])->subject($data['subject']);
                if(isset($data['replyTo'])) $message->replyTo($data['replyTo']);
            });
            return true;
        }
        elseif(isset($data['html']))
        {
            Mail::send(['html' =>'pulsar::common.views.html_display'], $data, function ($message) use ($data) {
                $message->to($data['email'], $data['name'])->subject($data['subject']);
                if(isset($data['replyTo'])) $message->replyTo($data['replyTo']);
            });
            return true;
        }
        elseif(isset($data['text']))
        {
            Mail::send(['text' =>'pulsar::common.views.text_display'], $data, function ($message) use ($data) {
                $message->to($data['email'], $data['name'])->subject($data['subject']);
                if(isset($data['replyTo'])) $message->replyTo($data['replyTo']);
            });
            return true;
        }

        return false;
    }
527265
public function deviceApplyId(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_DEVICE_APPLY_ID_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'] ? $result['data'] : false;
    }