Skip to content
Snippets Groups Projects
Commit 34cbd823 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fixes for lib/SimpleSAML/Utils

parent a9989b24
No related branches found
No related tags found
No related merge requests found
<?php
namespace SimpleSAML\Utils;
/**
......@@ -8,7 +9,6 @@ namespace SimpleSAML\Utils;
*/
class Arrays
{
/**
* Put a non-array variable into an array.
*
......
<?php
namespace SimpleSAML\Utils;
use SimpleSAML\Module;
......
<?php
namespace SimpleSAML\Utils;
/**
......
<?php
namespace SimpleSAML\Utils\Config;
/**
......@@ -106,6 +107,10 @@ class Metadata
// check the type
if (!isset($contact['contactType']) || !in_array($contact['contactType'], self::$VALID_CONTACT_TYPES, true)) {
$types = join(', ', array_map(
/**
* @param string $t
* @return string
*/
function ($t) {
return '"'.$t.'"';
},
......
<?php
namespace SimpleSAML\Utils;
use SimpleSAML\Configuration;
......@@ -462,8 +463,10 @@ class HTTP
// data and headers
if ($getHeaders) {
/** @psalm-suppress UndefinedVariable */
if (isset($http_response_header)) {
$headers = [];
/** @psalm-suppress UndefinedVariable */
foreach ($http_response_header as $h) {
if (preg_match('@^HTTP/1\.[01]\s+\d{3}\s+@', $h)) {
$headers = []; // reset
......
......@@ -11,6 +11,7 @@ class HttpAdapter
{
/**
* @see HTTP::getServerHTTPS()
* @return bool
*/
public function getServerHTTPS()
{
......@@ -19,6 +20,7 @@ class HttpAdapter
/**
* @see HTTP::getServerPort()
* @return int
*/
public function getServerPort()
{
......@@ -27,6 +29,10 @@ class HttpAdapter
/**
* @see HTTP::addURLParameters()
*
* @param string $url
* @param array $parameters
* @return string
*/
public function addURLParameters($url, $parameters)
{
......@@ -35,6 +41,9 @@ class HttpAdapter
/**
* @see HTTP::checkSessionCookie()
*
* @param string|null $retryURL
* @return void
*/
public function checkSessionCookie($retryURL = null)
{
......@@ -43,6 +52,10 @@ class HttpAdapter
/**
* @see HTTP::checkURLAllowed()
*
* @param string $url
* @param array|null $trustedSites
* @return bool
*/
public function checkURLAllowed($url, array $trustedSites = null)
{
......@@ -51,6 +64,11 @@ class HttpAdapter
/**
* @see HTTP::fetch()
*
* @param string $url
* @param array $context
* @param bool $getHeaders
* @return array|string
*/
public function fetch($url, $context = [], $getHeaders = false)
{
......@@ -59,6 +77,7 @@ class HttpAdapter
/**
* @see HTTP::getAcceptLanguage()
* @return string
*/
public function getAcceptLanguage()
{
......@@ -67,6 +86,7 @@ class HttpAdapter
/**
* @see HTTP::guessBasePath()
* @return string
*/
public function guessBasePath()
{
......@@ -75,6 +95,7 @@ class HttpAdapter
/**
* @see HTTP::getBaseURL()
* @return string
*/
public function getBaseURL()
{
......@@ -83,6 +104,9 @@ class HttpAdapter
/**
* @see HTTP::getFirstPathElement()
*
* @param $bool $trailingslash
* @return string
*/
public function getFirstPathElement($trailingslash = true)
{
......@@ -91,6 +115,10 @@ class HttpAdapter
/**
* @see HTTP::getPOSTRedirectURL()
*
* @param $string $destination
* @param array $data
* @return string
*/
public function getPOSTRedirectURL($destination, $data)
{
......@@ -99,6 +127,7 @@ class HttpAdapter
/**
* @see HTTP::getSelfHost()
* @return string
*/
public function getSelfHost()
{
......@@ -107,6 +136,7 @@ class HttpAdapter
/**
* @see HTTP::getSelfHostWithNonStandardPort()
* @return string
*/
public function getSelfHostWithNonStandardPort()
{
......@@ -115,6 +145,7 @@ class HttpAdapter
/**
* @see HTTP::getSelfHostWithPath()
* @return string
*/
public function getSelfHostWithPath()
{
......@@ -123,6 +154,7 @@ class HttpAdapter
/**
* @see HTTP::getSelfURL()
* @return string
*/
public function getSelfURL()
{
......@@ -131,6 +163,7 @@ class HttpAdapter
/**
* @see HTTP::getSelfURLHost()
* @return string
*/
public function getSelfURLHost()
{
......@@ -139,6 +172,7 @@ class HttpAdapter
/**
* @see HTTP::getSelfURLNoQuery()
* @return string
*/
public function getSelfURLNoQuery()
{
......@@ -147,6 +181,7 @@ class HttpAdapter
/**
* @see HTTP::isHTTPS()
* @return bool
*/
public function isHTTPS()
{
......@@ -155,6 +190,7 @@ class HttpAdapter
/**
* @see HTTP::normalizeURL()
* @return string
*/
public function normalizeURL($url)
{
......@@ -163,6 +199,9 @@ class HttpAdapter
/**
* @see HTTP::parseQueryString()
*
* @param string
* @return string
*/
public function parseQueryString($query_string)
{
......@@ -171,6 +210,10 @@ class HttpAdapter
/**
* @see HTTP::redirectTrustedURL()
*
* @param string $url
* @param array $parameters
* @return string
*/
public function redirectTrustedURL($url, $parameters = [])
{
......@@ -179,6 +222,10 @@ class HttpAdapter
/**
* @see HTTP::redirectUntrustedURL()
*
* @param string $url
* @param array $parameters
* @return string
*/
public function redirectUntrustedURL($url, $parameters = [])
{
......@@ -187,6 +234,10 @@ class HttpAdapter
/**
* @see HTTP::resolveURL()
*
* @param string $url
* @param string|null $base
* @return string
*/
public function resolveURL($url, $base = null)
{
......@@ -195,6 +246,12 @@ class HttpAdapter
/**
* @see HTTP::setCookie()
*
* @param string $name
* @param string $value
* @param array|null $params
* @param bool $throw
* @return void
*/
public function setCookie($name, $value, $params = null, $throw = true)
{
......@@ -203,6 +260,10 @@ class HttpAdapter
/**
* @see HTTP::submitPOSTData()
*
* @param string $destination
* @param array $data
* @return void
*/
public function submitPOSTData($destination, $data)
{
......
<?php
namespace SimpleSAML\Utils;
/**
......@@ -8,7 +9,6 @@ namespace SimpleSAML\Utils;
*/
class Net
{
/**
* Check whether an IP address is part of a CIDR.
*
......
<?php
namespace SimpleSAML\Utils;
/**
......@@ -8,7 +9,6 @@ namespace SimpleSAML\Utils;
*/
class Random
{
/**
* The fixed length of random identifiers.
*/
......
<?php
/**
* Utility class for XML and DOM manipulation.
*
......@@ -12,7 +13,6 @@ use SimpleSAML\XML\Errors;
class XML
{
/**
* This function performs some sanity checks on XML documents, and optionally validates them against their schema
* if the 'validatexml' debugging option is enabled. A warning will be printed to the log if validation fails.
......@@ -166,7 +166,7 @@ class XML
$textNodes = []; // text nodes which should be deleted
$childNodes = []; // other child nodes
for ($i = 0; $i < $root->childNodes->length; $i++) {
/** @var \DOMElement $child */
/** @var \DOMNode $child */
$child = $root->childNodes->item($i);
if ($child instanceof \DOMText) {
......@@ -288,7 +288,7 @@ class XML
$ret = [];
for ($i = 0; $i < $element->childNodes->length; $i++) {
/** @var \DOMElement $child */
/** @var \DOMNode $child */
$child = $element->childNodes->item($i);
// skip text nodes and comment elements
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment