mirror of
https://github.com/verdigado/organization_folders.git
synced 2024-11-23 05:00:27 +01:00
34 lines
609 B
PHP
34 lines
609 B
PHP
|
<?php
|
||
|
|
||
|
namespace OCA\OrganizationFolders\Traits;
|
||
|
|
||
|
trait ApiObjectController {
|
||
|
public const MODEL_INCLUDE = 'model';
|
||
|
|
||
|
/**
|
||
|
* @param string $include
|
||
|
*
|
||
|
* @return array
|
||
|
*/
|
||
|
public function parseIncludesString(?string $include): array {
|
||
|
if (isset($include)) {
|
||
|
$includes = array_filter(explode('+', $include));
|
||
|
|
||
|
if (!!$includes) {
|
||
|
return $includes;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return [self::MODEL_INCLUDE];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param string $test
|
||
|
* @param array $includes
|
||
|
*
|
||
|
* @return boolean
|
||
|
*/
|
||
|
public function shouldInclude(string $test, array $includes): bool {
|
||
|
return in_array($test, $includes);
|
||
|
}
|
||
|
}
|