Check if a custom Config class defines all required values

@param   array   $entries
@return  bool
543790
protected static function _validateConfig(array $entries)
    {
        $base = self::$_requires;
        foreach ($entries as $var=>$val) {
            if (in_array($var, $base)) {
                unset($base[array_search($var, $base)]);
            }
        }
        return (count($base)===0);
    }
3096
private function assertEntryHasRequiredKeys(array $entry)
    {
        if (!isset($entry[ISO3166::KEY_ALPHA2])) {
            throw new DomainException('Each data entry must have a valid alpha2 key.');
        }

        Guards::guardAgainstInvalidAlpha2($entry[ISO3166::KEY_ALPHA2]);

        if (!isset($entry[ISO3166::KEY_ALPHA3])) {
            throw new DomainException('Each data entry must have a valid alpha3 key.');
        }

        Guards::guardAgainstInvalidAlpha3($entry[ISO3166::KEY_ALPHA3]);

        if (!isset($entry[ISO3166::KEY_NUMERIC])) {
            throw new DomainException('Each data entry must have a valid numeric key.');
        }

        Guards::guardAgainstInvalidNumeric($entry[ISO3166::KEY_NUMERIC]);
    }
135094
public function isValid($vals)
    {
        $fields = $this->getFields();
        if (!Arr::iterable($fields)) {
            return true;
        }

        $result = true;

        // validate each field
        foreach ($fields as $k => $field) {
            // check if required
            if ($this->isRequired($field)) {
                if (!array_key_exists($k, $vals)
                        || is_null($vals[$k])
                        || $vals[$k] === ''
                        || $vals[$k] === false
                        || ($field['type'] === 'checkbox' && empty($vals[$k]))
                    ) {
                    $result = false;
                    $this->_messages[$k] = $this->getFieldRequiredMessage($k);
                    continue;
                }
            }

            // check maxlength
            if (array_key_exists('maxlength', $field)) {
                if (strlen($vals[$k]) > $field['maxlength']) {
                    $result = false;
                    $this->_messages[$k] = 'Value too long';
                    continue;
                }
            }

            // after this point, we're only checking values based on type
            if (!array_key_exists($k, $vals)) {
                continue;
            }
            if (!array_key_exists('type', $field)) {
                continue;
            }
 
            // Select
            if ($field['type'] === 'select') {
                if (!array_key_exists($vals[$k], $field['options'])) {
                    $result = false;
                    $this->_messages[$k] = 'Invalid option';
                }
                continue;
            }

            // Email
            if ($field['type'] === 'email') {
                if (!filter_var($vals[$k], FILTER_VALIDATE_EMAIL)) {
                    $result = false;
                    $this->_messages[$k] = 'Invalid email address';
                }
                continue;
            }

            // URL
            if ($field['type'] === 'url') {
                if (!filter_var($vals[$k], FILTER_VALIDATE_URL)) {
                    $result = false;
                    $this->_messages[$k] = 'Invalid URL';
                }
                continue;
            }

            // Color
            // http://www.w3.org/TR/html-markup/input.color.html#input.color.attrs.value
            if ($field['type'] === 'color') {
                if (!preg_match('/^#[0-9a-f]{6}$/i', $vals[$k])) {
                    $result = false;
                    $this->_messages[$k] = 'Invalid color';
                }
                continue;
            }
        }
        return $result;
    }
603556
protected function hasLanguageCodesAsKeys(array $fields)
    {
        $languageCodes = $this->getContentLanguageCodes();

        foreach ($fields as $fieldIdentifier => $fieldData) {
            if (!is_array($fieldData) || empty($fieldData)) {
                return false;
            }

            foreach ($fieldData as $key => $data) {
                if (!in_array($key, $languageCodes, true)) {
                    return false;
                }
            }
        }

        return true;
    }
331625
private function isStringArray($values) {
        if (!is_array($values)) {
            return false;
        }

        return array_reduce($values, function($res, $value) {
            return $res && is_string($value);
        }, true);
    }
765564
public function isValidConfig()
    {
        $missing = [];

        foreach ($this->required as $required) {
            if (!array_key_exists($required, $this->txpcfg)) {
                $missing[] = $required;
            }
        }

        if ($missing) {
            throw new \InvalidArgumentException(
                'Textpattern installation missing config values: '.implode(', ', $missing)
            );
        }
    }
1310838
public function isAllowed($entry)
    {
        foreach ($this->entries as $elmt) {
            if ($elmt->check($entry)) {
                return $this->matchingResponse;
            }
        }

        return null;
    }
230192
public function remove ($entry) {
		foreach ($this->data as $k => $v) {
			if ($v === $entry) {
				$associative = $this->isAssociative ();

				unset ($this->data[$k]);
				if ($associative) {
					$this->data = array_values ($this->data);
				}

				return true;

			}
		}
		return false;
	}
896118
protected function validateAbstractFactoryEntry($entry)
    {
        if (!is_string($entry) && !$entry instanceof AbstractFactoryInterface) {
            $type = is_object($entry) ? get_class($entry) : gettype($entry);
            $message = sprintf('Argument "entry" in "%s" must be a string or an instance '
                    . 'of "%s"; "%s" was given.', __METHOD__, AbstractFactoryInterface::class, $type);
            throw new Exception\InvalidArgumentException($message);
        }

        if (is_string($entry)) {
            if (!class_exists($entry)) {
                throw new Exception\ClassNotFoundException($entry);
            }

            if (!is_subclass_of($entry, AbstractFactoryInterface::class)) {
                $message = sprintf('Entry "%s" in "%s" is expected to be an instance of "%s".', $entry, __METHOD__, AbstractFactoryInterface::class);
                throw new Exception\InvalidArgumentException($message);
            }
        }
    }
628998
public function set_metadata($folder, $entries)
    {
        if (!$this->check_connection()) {
            return false;
        }

        $this->clear_cache('mailboxes.metadata.', true);

        if ($this->get_capability('METADATA') ||
            (!strlen($folder) && $this->get_capability('METADATA-SERVER'))
        ) {
            return $this->conn->setMetadata($folder, $entries);
        }
        else if ($this->get_capability('ANNOTATEMORE') || $this->get_capability('ANNOTATEMORE2')) {
            foreach ((array)$entries as $entry => $value) {
                list($ent, $attr) = $this->md2annotate($entry);
                $entries[$entry] = array($ent, $attr, $value);
            }
            return $this->conn->setAnnotation($folder, $entries);
        }

        return false;
    }
613891
protected static function filterConstant(array $values)
    {
        if (isset($values[1]) && in_array($values[1], self::VALID_CONSTANTS)) {
            $values[1] = constant($values[1]);
        }
        return $values[1];
    }
1163805
public function hasInputs(array $names) {
        foreach ($names as $name) {
            if (!$this->has($name))
                return false;
        }
        
        return true;
    }
953869
protected function formatEntries($entries)
    {
        $entries = Arr::flatten($entries);
        $entries = implode(PHP_EOL, $entries);
        $entries = trim($entries);

        return $entries;
    }
628026
public function datalist($entries = [])
    {
        $this->defaultAttribute('list', "list-{$this->id}");

        $datalist = "<datalist id=\"list-{$this->id}\">";
        foreach ($entries as $k => $v) {
            $datalist .= "<option value=\"{$k}\">{$v}</option>";
        }
        $datalist .= '</datalist>';

        return $this->append($datalist);
    }
313719
public static function validateProfilesConfiguration($profiles, array &$messages)
    {
        if (static::isNotArray($profiles)) {
            $messages[] = 'Profile configuration must be an array.';
        } else {
            array_walk($profiles, function ($config, $profile) use (&$messages) {
                if (static::isNotArray($config)) {
                    $messages[] = 'Profile configuration for "'.$profile.'" must be an array.';
                } else {
                    array_walk($config, function ($domains, $directive) use ($profile, &$messages) {
                        if (static::isNotArrayOrString($domains)) {
                            $messages[] = 'Directive configuration for "'.$profile.':'.$directive.'"'.
                                ' must be a string or an array.';
                        }
                    });
                }
            });
        }
    }
768680
public function isUploadArray($value) {
		if (!is_array($value)) {
			return false;
		}
		$requiredKeys = ['name', 'type', 'tmp_name', 'error', 'size'];
		$keys = array_keys($value);
		foreach ($requiredKeys as $key) {
			if (!in_array($key, $keys)) {
				return false;
			}
		}

		return true;
	}
677913
private function isValidConfigs(array $configs): void
    {
        $allowedConfigKeys = $this->getAllowedConfigKeys();
        if (!empty($configs)) {
            foreach ($configs as $key => $value) {
                if (!\in_array($key, $allowedConfigKeys, true)) {
                    throw new InvalidKeyException(sprintf(
                        '%s is not a valid key. configs must only contain "%s".',
                        $key,
                        implode(', ', $allowedConfigKeys)
                    ));
                }

                $this->isBool($key, $value);
                $this->isString($key, $value);
                $this->isValidNBest($key, $value);
            }
        }
    }