Пример #1
0
 public function validate(CM_Frontend_Environment $environment, $userInput)
 {
     $values = Functional\pluck($userInput, 'id');
     $values = array_unique($values);
     if ($this->_options['cardinality'] && count($values) > $this->_options['cardinality']) {
         throw new CM_Exception_FormFieldValidation(new CM_I18n_Phrase('Too many elements.'));
     }
     return $values;
 }
Пример #2
0
 /**
  * @param int $identifier
  * @return CM_Clockwork_Event
  * @throws CM_Exception
  */
 protected function _getRunningEvent($identifier)
 {
     $eventName = array_search($identifier, \Functional\pluck($this->_eventsRunning, 'identifier'));
     if (false === $eventName) {
         throw new CM_Exception('Could not find event', ['identifier' => $identifier]);
     }
     return $this->_eventsRunning[$eventName]['event'];
 }
Пример #3
0
 /**
  * @return string[]
  */
 protected function _listDatabaseNames()
 {
     $databasesInfo = $this->_getClient()->listDBs();
     return \Functional\pluck($databasesInfo['databases'], 'name');
 }