/** * Returns an array of the instances assigned to a cluster * * @param int|string $clusterId The cluster ID * * @return array */ public function getInstances($clusterId) { $_cluster = $this->_findCluster($clusterId); $_rows = Instance::byClusterId($_cluster->id)->get(['id', 'instance_name_text']); $_response = []; /** @type Instance $_instance */ foreach ($_rows as $_instance) { $_response[] = ['id' => $_instance->id, 'name' => $_instance->instance_name_text]; } //$this->debug('found ' . count($_response) . ' instance(s)'); usort($_response, function ($a, $b) { return strcasecmp($a['name'], $b['name']); }); return $_response; }