Check if a $key in $model is casted to datetime (timestamps, casts,...)

@param Model  $model
@param string $key

@return bool
187442
protected function isCastedToDateTime(Model $model, $key)
    {
        if (in_array($key, $model->getDates())) {
            return true;
        }

        if (method_exists($model, 'getDeletedAtColumn')) {
            return $key == $model->getDeletedAtColumn();
        }

        return false;
    }
95103
public function getTimestamp($key) {
		$key = $this->getRealKey ( $key );
		$cache = \apcu_cache_info ();
		if (empty ( $cache ['cache_list'] )) {
			return false;
		}
		foreach ( $cache ['cache_list'] as $entry ) {
			if ($entry ['info'] != $key) {
				continue;
			}
			$creationTime = $entry ['creation_time'];
			return $creationTime;
		}
		return \time ();
	}
1239234
public function is($model)
    {
        return ! is_null($model) &&
               $this->getKey() === $model->getKey() &&
               get_class($this) == get_class($model);
    }
521066
public function cacheKey(Model $model, $keys, $prefix = true)
    {

        // TranslateBehavior support
        if (!empty($model->locale)) {
            $keys = array_merge((array)$model->locale, (array)$keys);
        }

        if (is_array($keys)) {
            $key = array_shift($keys);

            if ($keys) {
                foreach ($keys as $value) {
                    if (is_array($value)) {
                        $key .= '-' . md5(json_encode($value));
                    } else if ($value) {
                        $key .= '-' . $value;
                    }
                }
            }
        } else {
            $key = (string)$keys;
        }

        if ($prefix) {
            $key = (string)$this->settings[$model->alias]['prefix'] . $key;
        }

        // Replace AppModel with the current Model so we don't run into conflicts
        $key = str_replace(array('AppModel', '::'), array($model->alias, '_'), $key);

        return $key;
    }
995618
public function process(Model $model)
    {
        $data = $model->getData();

        // Check if this is a possible callback.
        // We are not going to analyse this further, because modern systems
        // do not use these anymore.
        if (function_exists($data) === true) {
            $model->setIsCallback(true);
        }

        // Checking the encoding.
        $encoding = $this->pool->encodingService->mbDetectEncoding($data);
        if ($encoding === false) {
            // Looks like we have a mixed encoded string.
            // We need to tell the dev!
            $length = $this->pool->encodingService->mbStrLen($data);
            $strlen = 'broken encoding ' . $length;
            $model->addToJson(static::META_ENCODING, 'broken');
        } else {
            // Normal encoding, nothing special here.
            $length = $strlen = $this->pool->encodingService->mbStrLen($data, $encoding);
        }

        if ($length > 20) {
            // Getting mime type from the string.
            // With larger strings, there is a good chance that there is
            // something interesting in there.
            $model->addToJson(static::META_MIME_TYPE, $this->bufferInfo->buffer($data));
        }

        // Check, if we are handling large string, and if we need to use a
        // preview (which we call "extra").
        // We also need to check for linebreaks, because the preview can not
        // display those.
        if ($length > 50 || strstr($data, PHP_EOL) !== false) {
            $cut = $this->pool->encodingService->encodeString(
                $this->pool->encodingService->mbSubStr($data, 0, 50)
            ) . static::UNKNOWN_VALUE;

            $data = $this->pool->encodingService->encodeString($data);

            $model->setHasExtra(true)
                ->setNormal($cut)
                ->setData($data);
        } else {
            $model->setNormal($this->pool->encodingService->encodeString($data));
        }

        return $this->pool->render->renderSingleChild(
            $model->setType(static::TYPE_STRING . $strlen)
                ->addToJson(static::META_LENGTH, $length)
        );
    }
1027556
public function has($key)
    {
        if ($this->isAcceptable($key)) {
            $key = $this->modelKey($key);
        }

        return array_key_exists($key, $this->objects);
    }
488963
public static function castModel(Model $model)
    {
        $attributes = array_merge(
            $model->getAttributes(),
            $model->getRelations()
        );

        $visible = array_flip(
            $model->getVisible() ?: array_diff(array_keys($attributes), $model->getHidden())
        );

        $results = [];

        foreach (array_intersect_key($attributes, $visible) as $key => $value) {
            $results[(isset($visible[$key]) ? Caster::PREFIX_VIRTUAL : Caster::PREFIX_PROTECTED).$key] = $value;
        }

        return $results;
    }
882849
public function __isset( $key ) 
	{
		return ( array_key_exists( $key, $this->_data_store ) || method_exists( $this, '_get_modifier_'.$key ) ) ? true : false;
	}
336901
protected function getCasts(Model $model)
    {
        $class = get_class($model);

        if (!isset($this->castsCache[$class])) {
            $this->castsCache[$class] = Cheat::get($model, 'casts');
        }

        return $this->castsCache[$class];
    }
251471
public static function isFunction($model, $key) {
        $nombreLlamar = "";
        if (is_callable([$model, $key], true, $nombreLlamar) && method_exists($model, $key)) {
            $refClass = new \ReflectionClass($model);
            $refFunc = $refClass->getMethod($key);
            //$refFunc = new \ReflectionFunction($nombreLlamar);
            return $refFunc->getNumberOfParameters();
        } else {
            return false;
        }
    }
552774
public function mtime($key)
    {
        if ($object = $this->tryGetObject($key)) {
            return (new \DateTime($object->getLastModified()))->format('U');
        }

        return false;
    }
1223383
public function has(AbstractModel $model)
    {
        $key = $model->getCompositeKey();
        return isset($this->models[$key]);
    }
1075138
def has(self, key, mtime=None):
        
        v = self.__values.get(key, None)
        if not v:
            return False
        if self.check_modified_time:
            mtime = self._get_mtime(key, mtime)
            if mtime != self.__modified_times[key]:
                del self[key]
                return False
        return True
789625
public function saveEntity(Model $model)
    {
        $cacheKey = $this->cacheKey($model->toArray());
        $this->cache->forget($cacheKey);
        return $model->save();
    }
734999
private function hasCustomSetCaster($key)
    {
        return $this->hasCast($key) && method_exists($this, $this->getCustomSetCaster($key));
    }
1070360
public function isTimedOut($key)
    {
        // if the item is available and has timed out, return TRUE
        if (array_key_exists($key, $this->lifetime) && $this->lifetime[$key] < time()) {
            return true;
        }
        // else return FALSE
        return false;
    }
439057
public function remove($key, Model $model)
    {
        if (false === $this->isHasMany($key)) {
            return $this;
        }
        if (true === $this->isInverse($key)) {
            throw ModelException::cannotModifyInverse($this, $key);
        }
        $this->touch();
        $collection = $this->hasManyRelationships->get($key);
        $collection->remove($model);
        $this->doDirtyCheck();
        return $this;
    }