public function __construct($ctype, $settings = [], $uuid = null) { $this->ctype = $ctype; $this->pathAlias = $this->ctype == 'elements' ? '@app/workspace' : '@app/workspace/data'; if (!empty($uuid)) { $this->uuid = $uuid; if ($theFile = @file_get_contents($this->resolveDataSource($uuid))) { $this->allModels[] = $this->processSingle(\yii\helpers\Json::decode($theFile), true); } else { $this->allModels[] = []; } } else { $dataModels = \Yii::$app->cache->get('crc_' . $ctype); if ($dataModels === false) { // $data is not found in cache, calculate it from scratch $dataModels = $this->parseFolderContent($this->ctype); // store $data in cache so that it can be retrieved next time \Yii::$app->cache->set('crc_' . $ctype, $dataModels); } $this->allModels = $dataModels; } if (Arrays::has($settings, 'filter')) { if (!empty($settings['filter'])) { $this->filterModels($settings['filter']); } } if (Arrays::has($settings, 'sort')) { if (!empty($settings['sort'])) { $this->sortModels($settings['sort']); } } parent::__construct(); }
function validate_whitelist() { return Object::values(Arrays::clean(Arrays::each(Object::keys($_POST), function ($key) { if (!Arrays::has($this->get_fields(), $key)) { return $this->build_error('illegal', array('%key%' => $key)); } }))); }
public function testCanCheckIfHasValue() { $under = Arrays::has($this->array, 'foo'); $this->assertTrue($under); }