diff --git a/lib/SimpleSAML/XHTML/EMail.php b/lib/SimpleSAML/XHTML/EMail.php index fc5441ef4cdfebbda1e135af722cd7b7905aa982..ac52e411147e948f09f421c67923e1ab1482b49a 100644 --- a/lib/SimpleSAML/XHTML/EMail.php +++ b/lib/SimpleSAML/XHTML/EMail.php @@ -11,17 +11,36 @@ namespace SimpleSAML\XHTML; class EMail { + /** @var string|null */ private $to = null; + + /** @var string|null */ private $cc = null; + + /** @var string|null */ private $body = null; + + /** @var string|null */ private $from = null; + + /** @var string|null */ private $replyto = null; + + /** @var string|null */ private $subject = null; + + /** @var array */ private $headers = []; /** * Constructor + * + * @param string $to + * @param string $subject + * @param string|null $from + * @param string|null $cc + * @param string|null $replyto */ public function __construct($to, $subject, $from = null, $cc = null, $replyto = null) { @@ -32,7 +51,7 @@ class EMail $this->subject = $subject; } - /* + /** * @param string $body * @return void */ @@ -42,7 +61,7 @@ class EMail } - /* + /** * @param string $body * @return string */ @@ -55,7 +74,7 @@ class EMail } - /* + /** * @return void */ public function send() diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php index 51449f95f970297a48f2fe11bfe1278ac43a04f9..0fb503807b7271a313d5fcdd26043d035d7d8474 100644 --- a/lib/SimpleSAML/XHTML/IdPDisco.php +++ b/lib/SimpleSAML/XHTML/IdPDisco.php @@ -173,6 +173,7 @@ class IdPDisco * discovery service type. * * @param string $message The message which should be logged. + * @return void */ protected function log($message) { @@ -188,7 +189,7 @@ class IdPDisco * * @param string $name The name of the cookie. * - * @return string The value of the cookie with the given name, or null if no cookie with that name exists. + * @return string|null The value of the cookie with the given name, or null if no cookie with that name exists. */ protected function getCookie($name) { @@ -209,6 +210,7 @@ class IdPDisco * * @param string $name The name of the cookie. * @param string $value The value of the cookie. + * @return void */ protected function setCookie($name, $value) { @@ -267,7 +269,7 @@ class IdPDisco * * This function finds out which IdP the user has manually chosen, if any. * - * @return string The entity id of the IdP the user has chosen, or null if the user has made no choice. + * @return string|null The entity id of the IdP the user has chosen, or null if the user has made no choice. */ protected function getSelectedIdP() { @@ -303,7 +305,7 @@ class IdPDisco /** * Retrieve the users saved choice of IdP. * - * @return string The entity id of the IdP the user has saved, or null if the user hasn't saved any choice. + * @return string|null The entity id of the IdP the user has saved, or null if the user hasn't saved any choice. */ protected function getSavedIdP() { @@ -329,7 +331,7 @@ class IdPDisco /** * Retrieve the previous IdP the user used. * - * @return string The entity id of the previous IdP the user used, or null if this is the first time. + * @return string|null The entity id of the previous IdP the user used, or null if this is the first time. */ protected function getPreviousIdP() { @@ -361,7 +363,7 @@ class IdPDisco * This function will first look at the previous IdP the user has chosen. If the user * hasn't chosen an IdP before, it will look at the IP address. * - * @return string The entity id of the IdP the user should most likely use. + * @return string|null The entity id of the IdP the user should most likely use. */ protected function getRecommendedIdP() { @@ -386,6 +388,7 @@ class IdPDisco * Save the current IdP choice to a cookie. * * @param string $idp The entityID of the IdP. + * @return void */ protected function setPreviousIdP($idp) { @@ -419,7 +422,7 @@ class IdPDisco /** * Determine which IdP the user should go to, if any. * - * @return string The entity id of the IdP the user should be sent to, or null if the user should choose. + * @return string|null The entity id of the IdP the user should be sent to, or null if the user should choose. */ protected function getTargetIdP() { @@ -543,6 +546,7 @@ class IdPDisco * Handles a request to this discovery service. * * The IdP disco parameters should be set before calling this function. + * @return void */ public function handleRequest() { @@ -619,7 +623,12 @@ class IdPDisco } usort( $newlist, - function ($idpentry1, $idpentry2) { + /** + * @param array $idpentry1 + * @param array $idpentry2 + * @return int + */ + function (array $idpentry1, array $idpentry2) { return strcasecmp($idpentry1['name'], $idpentry2['name']); } ); @@ -634,6 +643,12 @@ class IdPDisco $t->show(); } + + /** + * @param array $idpData + * @param string $language + * @return string|null + */ private function getEntityDisplayName(array $idpData, $language) { if (isset($idpData['UIInfo']['DisplayName'][$language])) { diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 43127d9a0dc64c70db17b96c331109ca39054fa0..d8c7c42fd649d85f41138a603656e5e57530e124 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -75,7 +75,7 @@ class Template extends Response * * @var bool */ - private $useNewUI; + private $useNewUI = false; /** @@ -85,9 +85,9 @@ class Template extends Response * the 'theme.controller' configuration option to a class that implements the * \SimpleSAML\XHTML\TemplateControllerInterface interface to use it. * - * @var \SimpleSAML\XHTML\TemplateControllerInterface + * @var \SimpleSAML\XHTML\TemplateControllerInterface|null */ - private $controller; + private $controller = null; /** @@ -97,9 +97,9 @@ class Template extends Response * of the module and the name of the theme, respectively. If we are using the default theme, the variable has * the 'default' string in the "name" key, and 'null' in the "module" key. * - * @var array + * @var array|null */ - private $theme; + private $theme = null; /** * Constructor @@ -200,7 +200,7 @@ class Template extends Response $templateName = substr($templateName, 0, $tplpos); } - if ($this->useNewUI || $this->theme['module'] !== null) { + if ($this->useNewUI || ($this->theme['module'] !== null)) { return $templateName.'.twig'; } return $templateName; @@ -250,6 +250,7 @@ class Template extends Response /** * Setup twig. + * @return \Twig_Environment|false */ private function setupTwig() { @@ -310,7 +311,7 @@ class Template extends Response // add an asset() function $twig->addFunction(new \Twig_SimpleFunction('asset', [$this, 'asset'])); - if ($this->controller) { + if ($this->controller !== null) { $this->controller->setUpTwig($twig); } @@ -357,6 +358,7 @@ class Template extends Response /** * Get the template directory of a module, if it exists. * + * @param string $module * @return string The templates directory of a module * * @throws \InvalidArgumentException If the module is not enabled or it has no templates directory. @@ -382,8 +384,8 @@ class Template extends Response * Note that the module must be installed, enabled, and contain a "templates" directory. * * @param string $module The module where we need to search for templates. - * * @throws \InvalidArgumentException If the module is not enabled or it has no templates directory. + * @return void */ public function addTemplatesFromModule($module) { @@ -398,7 +400,7 @@ class Template extends Response * Generate an array for its use in the language bar, indexed by the ISO 639-2 codes of the languages available, * containing their localized names and the URL that should be used in order to change to that language. * - * @return array The array containing information of all available languages. + * @return array|null The array containing information of all available languages. */ private function generateLanguageBar() { @@ -430,6 +432,7 @@ class Template extends Response /** * Set some default context + * @return void */ private function twigDefaultContext() { @@ -497,6 +500,7 @@ class Template extends Response * This method is a remnant of the old templating system, where templates where shown manually instead of * returning a response. * + * @return void * @deprecated Do not use this method, use Twig + send() instead. Will be removed in 2.0 */ public function show() @@ -533,8 +537,9 @@ class Template extends Response * template file in the given module. * * @param string $template The relative path from the theme directory to the template file. + * @param bool $throw_exception * - * @return string The absolute path to the template file. + * @return string|null The absolute path to the template file. * * @throws \Exception If the template file couldn't be found. */ @@ -635,7 +640,7 @@ class Template extends Response /** - * @param $name + * @param string $name * * @return string * @deprecated This method will be removed in SSP 2.0. Please use \SimpleSAML\Locale\Language::getLanguage() @@ -659,8 +664,9 @@ class Template extends Response /** - * @param $language + * @param string $language * @param bool $setLanguageCookie + * @return void * * @deprecated This method will be removed in SSP 2.0. Please use \SimpleSAML\Locale\Language::setLanguage() * instead. @@ -683,7 +689,8 @@ class Template extends Response /** - * @param $language + * @param string $language + * @return void * * @deprecated This method will be removed in SSP 2.0. Please use \SimpleSAML\Locale\Language::setLanguageCookie() * instead. @@ -696,6 +703,8 @@ class Template extends Response /** * Wraps Language->getLanguageList + * + * @return array */ private function getLanguageList() { @@ -704,7 +713,7 @@ class Template extends Response /** - * @param $tag + * @param string $tag * * @return array * @deprecated This method will be removed in SSP 2.0. Please use \SimpleSAML\Locale\Translate::getTag() instead. @@ -720,6 +729,9 @@ class Template extends Response * * @deprecated This method will be removed in SSP 2.0. Please use * \SimpleSAML\Locale\Translate::getPreferredTranslation() instead. + * + * @param array $translations + * @return string */ public function getTranslation($translations) { @@ -731,6 +743,8 @@ class Template extends Response * Includes a file relative to the template base directory. * This function can be used to include headers and footers etc. * + * @param string $file + * @return void */ private function includeAtTemplateBase($file) { @@ -748,6 +762,10 @@ class Template extends Response * @see \SimpleSAML\Locale\Translate::includeInlineTranslation() * @deprecated This method will be removed in SSP 2.0. Please use * \SimpleSAML\Locale\Translate::includeInlineTranslation() instead. + * + * @param string $tag + * @param string $translation + * @return void */ public function includeInlineTranslation($tag, $translation) { @@ -758,6 +776,7 @@ class Template extends Response /** * @param string $file * @param \SimpleSAML\Configuration|null $otherConfig + * @return void * * @deprecated This method will be removed in SSP 2.0. Please use * \SimpleSAML\Locale\Translate::includeLanguageFile() instead. @@ -770,6 +789,8 @@ class Template extends Response /** * Wrap Language->isLanguageRTL + * + * @return bool */ private function isLanguageRTL() { @@ -802,6 +823,9 @@ class Template extends Response * * @see \SimpleSAML\Locale\Translate::noop() * @deprecated This method will be removed in SSP 2.0. Please use \SimpleSAML\Locale\Translate::noop() instead. + * + * @param string $tag + * @return string */ public static function noop($tag) { @@ -814,6 +838,13 @@ class Template extends Response * * @see \SimpleSAML\Locale\Translate::t() * @deprecated This method will be removed in SSP 2.0. Please use \SimpleSAML\Locale\Translate::t() instead. + * + * @param string $tag + * @param array $replacements + * @param bool $fallbackdefault + * @param array $oldreplacements + * @param bool $striptags + * @return string */ public function t( $tag, diff --git a/lib/SimpleSAML/XHTML/TemplateLoader.php b/lib/SimpleSAML/XHTML/TemplateLoader.php index c5090d5544612a05e68270e28eda74e57310b352..b8de4368e5457709a1604050fc6f1432214c17de 100644 --- a/lib/SimpleSAML/XHTML/TemplateLoader.php +++ b/lib/SimpleSAML/XHTML/TemplateLoader.php @@ -14,7 +14,7 @@ class TemplateLoader extends \Twig\Loader\FilesystemLoader /** * This method adds a namespace dynamically so that we can load templates from modules whenever we want. * - * @inheritdoc + * {@inheritdoc} */ protected function findTemplate($name, $throw = true) { @@ -30,6 +30,7 @@ class TemplateLoader extends \Twig\Loader\FilesystemLoader * Parse the name of a template in a module. * * @param string $name The full name of the template, including namespace and template name / path. + * @param string $default * * @return array An array with the corresponding namespace and name of the template. The namespace defaults to * \Twig\Loader\FilesystemLoader::MAIN_NAMESPACE, if none was specified in $name. @@ -52,6 +53,7 @@ class TemplateLoader extends \Twig\Loader\FilesystemLoader /** * Get the template directory of a module, if it exists. * + * @param string $module * @return string The templates directory of a module. * * @throws \InvalidArgumentException If the module is not enabled or it has no templates directory.