Validates that the required fields were retrieved and retrieves them if missing

@param array $list array of the fields that need to be validated
@param string $caller name of the function that requested it, for the debugging message
174331
protected function ensure_fields_exist($list, $caller) {
        global $DB;
        $missing = array_diff($list, array_keys((array)$this->record));
        if ($missing) {
            debugging('core_tag_tag::' . $caller . '() must be called on fully retrieved tag object. Missing fields: '.
                    join(', ', $missing), DEBUG_DEVELOPER);
            $this->record = $DB->get_record('tag', array('id' => $this->record->id), '*', MUST_EXIST);
        }
    }
272992
static function checkRequiredParametersAreSet(array $given, array $required)
    {
        foreach ($required as $key) {
            if (empty($given[$key])) {
                throw new MissingRequiredParameterException(
                        "Missing required parameter '$key'"
                );
            }
        }
    }
2191
public function validateSortField(SS_List $list)
    {
        $field = $this->getSortField();

        // Check extra fields on many many relation types
        if ($list instanceof ManyManyList) {
            $extra = $list->getExtraFields();

            if ($extra && array_key_exists($field, $extra)) {
                return;
            }
        } elseif ($list instanceof ManyManyThroughList) {
            $manipulator = $this->getManyManyInspector($list);
            $fieldTable = DataObject::getSchema()->tableForField($manipulator->getJoinClass(), $field);
            if ($fieldTable) {
                return;
            }
        }

        $classes = ClassInfo::dataClassesFor($list->dataClass());

        foreach ($classes as $class) {
            if (singleton($class)->hasDataBaseField($field)) {
                return;
            }
        }

        throw new Exception("Couldn't find the sort field '" . $field . "'");
    }
1112789
protected function validate_contains_list($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }

        $param = trim(strtolower($param));

        $value = trim(strtolower($input[$field]));

        $param = explode(';', $param);

        // consider: in_array(strtolower($value), array_map('strtolower', $param)

        if (in_array($value, $param)) { // valid, return nothing
            return;
        } else {
            return array(
                'field' => $field,
                'value' => $value,
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }
    }
530398
public function contains(array $list)
    {
        phpCAS::traceBegin();
        $count = 0;
        foreach ($this->_chains as $chain) {
            phpCAS::trace("Checking chain ". $count++);
            if ($chain->matches($list)) {
                phpCAS::traceEnd(true);
                return true;
            }
        }
        phpCAS::trace("No proxy chain matches.");
        phpCAS::traceEnd(false);
        return false;
    }
553160
public function assigns ($list) {
		foreach ($list as $name => $value) {
			$this->render[$name] = $value;
		}
	}
1358447
public function checkIn($value, $list)
    {
        // List is passed as second parameter or with many single parameters
        $args = func_get_args();
        array_shift($args); // remove $value

        $items = count($args) > 1 ? $args : (array)$list;

        return in_array($value, $items);
    }
690486
protected function prepareListReportEvent(array &$list)
    {
        foreach ($list as &$item) {

            $variables = array();

            if (!empty($item['data']['variables'])) {
                $variables = $item['data']['variables'];
            }

            $item['created'] = $this->date($item['created']);

            $type = "event_{$item['type']}";
            $item['type'] = $this->text($type);

            if (!empty($item['translatable'])) {
                $item['text'] = $this->text($item['text'], $variables);
            }

            $item['summary'] = $this->truncate($item['text']);
            $item['severity_text'] = $this->text($item['severity']);
        }
    }
1232563
protected function checkEntry( array $list )
	{
		if( $this->getValue( $list, 'attribute.code' ) === null ) {
			return false;
		}

		if( ( $type = $this->getValue( $list, 'product.lists.type' ) ) && !isset( $this->listTypes[$type] ) )
		{
			$msg = sprintf( 'Invalid type "%1$s" (%2$s)', $type, 'product list' );
			throw new \Aimeos\Controller\Common\Exception( $msg );
		}

		if( ( $type = $this->getValue( $list, 'attribute.type' ) ) && !isset( $this->types[$type] ) )
		{
			$msg = sprintf( 'Invalid type "%1$s" (%2$s)', $type, 'attribute' );
			throw new \Aimeos\Controller\Common\Exception( $msg );
		}

		return true;
	}
772215
protected function prepareListUser(array &$list)
    {
        $stores = $this->store->getList();

        foreach ($list as &$item) {

            $item['url'] = '';

            if (isset($stores[$item['store_id']])) {
                $item['url'] = $this->store->getUrl($stores[$item['store_id']]) . "/account/{$item['user_id']}";
            }
        }
    }
1139829
public function getList($list)
	{
		$result = $this->client->get("lists/{$list}");
		return $result ? new Resources\MailingList($this, $result) : null;
	}
827800
protected function listQueryParams(array $list)
    {
        $result = [];
        $params = $this->getRequest()->getQueryParams();
        
        foreach ($list as $key => $value) {
            if (is_int($key)) {
                $key = $value;
                $value = null;
            }
            
            $result[] = isset($params[$key]) ? $params[$key] : $value;
        }
        
        return $result;
    }
543666
public function exCreateList(MailingList &$list)
		{
			$form_data = array(
				'list_name'    => $list->getListName(),
				'description'  => $list->getDescription(),
				'template_id'  => $list->getTemplate(),
				'from'         => $list->getFromAddress(),
				'reply_to'     => $list->getReplyToAddress(),
				'errors_to'    => $list->getBounceAddress(),
				'track_clicks' => $list->isTrackClicks(),
				'track_opens'  => $list->isTrackOpens(),
				'folder_id'    => $list->getFolderId()
			);
			$data = $this->call('excreatelist', $form_data);

			$list->setListId(trim($data[1]));
		}
1231596
public function validationResponse(\Psc\Form\ValidatorExceptionList $list, $format = ServiceResponse::JSON, MetadataGenerator $metadataGenerator = NULL) {
    if ($format === ServiceResponse::JSON) {
      $body = (object) array('errors'=>array());
    
      foreach ($list->getExceptions() as $validatorException) {
        $body->errors[$validatorException->field] = $validatorException->getMessage();
      }
    
      return HTTPResponseException::BadRequest(json_encode($body), NULL, array('Content-Type'=>'application/json'));
    } else {
      $metadataGenerator = $metadataGenerator ?: new MetadataGenerator();
      
      return HTTPException::BadRequest(
          $list->getMessage(),
          $list,
          array_merge(
            array('Content-Type'=>'text/html'),
            $metadataGenerator->validationList($list)->toHeaders()
          )
      );
    }
  }
817218
protected function checkDependenciesListModule(array &$list)
    {
        $this->validateDependencies($list);
        $list = $this->graph->build($list);
    }
831444
function validateObjectList( $package, $http, $currentStepID, &$stepMap, &$persistentData, &$errorList )
    {
        if ( count( $persistentData['node_list'] ) == 0 )
        {
            $errorList[] = array( 'field' => ezpI18n::tr( 'kernel/package', 'Selected nodes' ),
                                  'description' => ezpI18n::tr( 'kernel/package', 'You must select one or more node(s)/subtree(s) for export.' ) );
            return false;
        }

        return true;
    }
453037
private function verifyRequiredFieldIsAvailable($fieldId)
    {
        //====================================================================//
        // Detect List Field Names
        if (!method_exists($this, "Lists") || !self::lists()->listName($fieldId)) {
            //====================================================================//
            // Simple Field is Required but not available
            if (empty($this->in[$fieldId])) {
                return false;
            }

            return true;
        }
        //====================================================================//
        // List Field is required
        $listName = self::lists()->ListName($fieldId);
        $fieldName = self::lists()->FieldName($fieldId);
        //====================================================================//
        // Check List is available
        if (empty($this->in[$listName])) {
            return false;
        }
        //====================================================================//
        // list is a List...
        if (!is_array($this->in[$listName]) && !is_a($this->in[$listName], "ArrayObject")) {
            return false;
        }
        //====================================================================//
        // Check Field is Available
        foreach ($this->in[$listName] as $item) {
            if (empty($item[$fieldName])) {
                return false;
            }
        }

        return true;
    }