File: D:/HostingSpaces/SBogers10/ste.komma.pro/vendor/komma/feedback-company/src/Base/ApiResource.php
<?php
namespace Komma\FeedbackCompany\Base;
abstract class ApiResource
{
/**
* The attributes that are remapped.
*
* @var array
*/
protected array $remappedAttributes = [];
/**
* The attributes that are we ignore from the API.
*
* @var array
*/
protected array $ignoredAttributes = [];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected array $dates = [];
/**
* Check if the attribute is remapped.
*
* @param string $attribute
* @return bool
*/
public function isRemappedAttribute(string $attribute)
{
return in_array($attribute, array_keys($this->remappedAttributes));
}
/**
* Get the remapped attribute key.
*
* @param string $attribute
* @return string
*/
public function getRemappedAttributeKey(string $attribute): string
{
return $this->remappedAttributes[$attribute];
}
/**
* Check if the attribute can be ignored.
*
* @param string $attribute
* @return bool
*/
public function isIgnoredAttribute(string $attribute)
{
return in_array($attribute, $this->ignoredAttributes);
}
/**
* Get the attributes that should be converted to dates.
*
* @return array
*/
public function getDatesAttributes()
{
return $this->dates;
}
/**
* Determine if the given attribute is a date or date castable.
*
* @param string $key
* @return bool
*/
public function isDateAttribute($key)
{
return in_array($key, $this->getDatesAttributes(), true);
}
}