Skip to content

Commit 2aaad20

Browse files
kberzinchjfritschi
authored andcommitted
phpDoc fixes, dead code cleanup (#298)
1 parent 6d9ed17 commit 2aaad20

15 files changed

+149
-163
lines changed

source/CAS.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248

249249
/**
250250
* The default directory for the debug file under Unix.
251+
* @return string directory for the debug file
251252
*/
252253
function gettmpdir() {
253254
if (!empty($_ENV['TMP'])) { return realpath($_ENV['TMP']); }
@@ -291,6 +292,7 @@ class phpCAS
291292
private static $_PHPCAS_CLIENT;
292293

293294
/**
295+
* @var array
294296
* This variable is used to store where the initializer is called from
295297
* (to print a comprehensive error in case of multiple calls).
296298
*
@@ -299,6 +301,7 @@ class phpCAS
299301
private static $_PHPCAS_INIT_CALL;
300302

301303
/**
304+
* @var array
302305
* This variable is used to store phpCAS debug mode.
303306
*
304307
* @hideinitializer
@@ -334,7 +337,7 @@ class phpCAS
334337
* @param bool $changeSessionID Allow phpCAS to change the session_id (Single
335338
* Sign Out/handleLogoutRequests is based on that change)
336339
*
337-
* @return a newly created CAS_Client object
340+
* @return void a newly created CAS_Client object
338341
* @note Only one of the phpCAS::client() and phpCAS::proxy functions should be
339342
* called, only once, and before all other methods (except phpCAS::getVersion()
340343
* and phpCAS::setDebug()).
@@ -373,12 +376,12 @@ public static function client($server_version, $server_hostname,
373376
*
374377
* @param string $server_version the version of the CAS server
375378
* @param string $server_hostname the hostname of the CAS server
376-
* @param string $server_port the port the CAS server is running on
379+
* @param int $server_port the port the CAS server is running on
377380
* @param string $server_uri the URI the CAS server is responding on
378381
* @param bool $changeSessionID Allow phpCAS to change the session_id (Single
379382
* Sign Out/handleLogoutRequests is based on that change)
380383
*
381-
* @return a newly created CAS_Client object
384+
* @return void a newly created CAS_Client object
382385
* @note Only one of the phpCAS::client() and phpCAS::proxy functions should be
383386
* called, only once, and before all other methods (except phpCAS::getVersion()
384387
* and phpCAS::setDebug()).
@@ -495,7 +498,7 @@ public static function setVerbose($verbose)
495498
/**
496499
* Show is verbose mode is on
497500
*
498-
* @return boot verbose
501+
* @return bool verbose
499502
*/
500503
public static function getVerbose()
501504
{
@@ -635,7 +638,7 @@ public static function traceBegin()
635638
* This method is used to indicate the end of the execution of a function in
636639
* debug mode.
637640
*
638-
* @param string $res the result of the function
641+
* @param mixed $res the result of the function
639642
*
640643
* @return void
641644
*/
@@ -646,7 +649,6 @@ public static function traceEnd($res = '')
646649
} else {
647650
self::$_PHPCAS_DEBUG['indent']--;
648651
}
649-
$dbg = debug_backtrace();
650652
$str = '';
651653
if (is_object($res)) {
652654
$str .= '<= ' . get_class($res);
@@ -713,7 +715,7 @@ public static function setLang($lang)
713715
/**
714716
* This method returns the phpCAS version.
715717
*
716-
* @return the phpCAS version.
718+
* @return string the phpCAS version.
717719
*/
718720
public static function getVersion()
719721
{
@@ -723,7 +725,7 @@ public static function getVersion()
723725
/**
724726
* This method returns supported protocols.
725727
*
726-
* @return an array of all supported protocols. Use internal protocol name as array key.
728+
* @return array an array of all supported protocols. Use internal protocol name as array key.
727729
*/
728730
public static function getSupportedProtocols()
729731
{
@@ -793,8 +795,8 @@ public static function setHTMLFooter($footer)
793795
/**
794796
* This method can be used to set a custom PGT storage object.
795797
*
796-
* @param CAS_PGTStorage $storage a PGT storage object that inherits from the
797-
* CAS_PGTStorage class
798+
* @param CAS_PGTStorage_AbstractStorage $storage a PGT storage object that inherits from the
799+
* CAS_PGTStorage_AbstractStorage class
798800
*
799801
* @return void
800802
*/
@@ -923,7 +925,7 @@ public static function initializeProxiedService (CAS_ProxiedService $proxiedServ
923925
* This method is used to access an HTTP[S] service.
924926
*
925927
* @param string $url the service to access.
926-
* @param string &$err_code an error code Possible values are
928+
* @param int &$err_code an error code Possible values are
927929
* PHPCAS_SERVICE_OK (on success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE,
928930
* PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, PHPCAS_SERVICE_PT_FAILURE,
929931
* PHPCAS_SERVICE_NOT_AVAILABLE.
@@ -956,15 +958,15 @@ public static function serviceWeb($url, & $err_code, & $output)
956958
* including the mailing box for IMAP URLs, as accepted by imap_open().
957959
* @param string $service a string giving for CAS retrieve Proxy ticket
958960
* @param string $flags options given to imap_open().
959-
* @param string &$err_code an error code Possible values are
961+
* @param int &$err_code an error code Possible values are
960962
* PHPCAS_SERVICE_OK (on success), PHPCAS_SERVICE_PT_NO_SERVER_RESPONSE,
961963
* PHPCAS_SERVICE_PT_BAD_SERVER_RESPONSE, PHPCAS_SERVICE_PT_FAILURE,
962964
* PHPCAS_SERVICE_NOT_AVAILABLE.
963965
* @param string &$err_msg an error message on failure
964966
* @param string &$pt the Proxy Ticket (PT) retrieved from the CAS
965967
* server to access the URL on success, false on error).
966968
*
967-
* @return object IMAP stream on success, false otherwise (in this later
969+
* @return object|false IMAP stream on success, false otherwise (in this later
968970
* case, $err_code gives the reason why it failed and $err_msg contains an
969971
* error message).
970972
*/
@@ -1047,7 +1049,7 @@ public static function setCasAttributeParserCallback($function, array $additiona
10471049
* logs in (such as registering an account, performing logging, etc), register
10481050
* a callback function here.
10491051
*
1050-
* @param string $function Callback function
1052+
* @param callable $function Callback function
10511053
* @param array $additionalArgs optional array of arguments
10521054
*
10531055
* @return void
@@ -1068,7 +1070,7 @@ public static function setPostAuthenticateCallback ($function, array $additional
10681070
* applications that manage their own sessions (rather than letting phpCAS
10691071
* start and destroy the session).
10701072
*
1071-
* @param string $function Callback function
1073+
* @param callable $function Callback function
10721074
* @param array $additionalArgs optional array of arguments
10731075
*
10741076
* @return void
@@ -1086,7 +1088,7 @@ public static function setSingleSignoutCallback ($function, array $additionalArg
10861088
* determined by a cas gateway call.(cas login call without any interactive
10871089
* prompt)
10881090
*
1089-
* @return true when the user is authenticated, false when a previous
1091+
* @return bool true when the user is authenticated, false when a previous
10901092
* gateway login failed or the function will not return if the user is
10911093
* redirected to the cas server for a gateway login attempt
10921094
*/
@@ -1154,7 +1156,7 @@ public static function renewAuthentication()
11541156
* This method is called to check if the user is authenticated (previously or by
11551157
* tickets given in the URL).
11561158
*
1157-
* @return true when the user is authenticated.
1159+
* @return bool true when the user is authenticated.
11581160
*/
11591161
public static function isAuthenticated()
11601162
{
@@ -1289,7 +1291,7 @@ public static function getAttribute($key)
12891291
*
12901292
* @return void
12911293
*/
1292-
public static function handleLogoutRequests($check_client = true, $allowed_clients = false)
1294+
public static function handleLogoutRequests($check_client = true, $allowed_clients = array())
12931295
{
12941296
phpCAS::_validateClientExists();
12951297

@@ -1298,9 +1300,8 @@ public static function handleLogoutRequests($check_client = true, $allowed_clien
12981300

12991301
/**
13001302
* This method returns the URL to be used to login.
1301-
* or phpCAS::isAuthenticated().
13021303
*
1303-
* @return the login name of the authenticated user
1304+
* @return string the login URL
13041305
*/
13051306
public static function getServerLoginURL()
13061307
{
@@ -1405,10 +1406,9 @@ public static function setServerSamlValidateURL($url = '')
14051406
}
14061407

14071408
/**
1408-
* This method returns the URL to be used to login.
1409-
* or phpCAS::isAuthenticated().
1409+
* This method returns the URL to be used to logout.
14101410
*
1411-
* @return the login name of the authenticated user
1411+
* @return string the URL to use to log out
14121412
*/
14131413
public static function getServerLogoutURL()
14141414
{
@@ -1612,7 +1612,7 @@ public static function getServiceURL()
16121612
* Retrieve a Proxy Ticket from the CAS server.
16131613
*
16141614
* @param string $target_service Url string of service to proxy
1615-
* @param string &$err_code error code
1615+
* @param int &$err_code error code
16161616
* @param string &$err_msg error message
16171617
*
16181618
* @return string Proxy Ticket

source/CAS/AuthenticationException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CAS_AuthenticationException
6666
* @param string $err_msg the error message given by the CAS server
6767
*/
6868
public function __construct($client,$failure,$cas_url,$no_response,
69-
$bad_response='',$cas_response='',$err_code='',$err_msg=''
69+
$bad_response=false,$cas_response='',$err_code=-1,$err_msg=''
7070
) {
7171
$messages = array();
7272
phpCAS::traceBegin();
@@ -91,7 +91,7 @@ public function __construct($client,$failure,$cas_url,$no_response,
9191
break;
9292
case CAS_VERSION_2_0:
9393
case CAS_VERSION_3_0:
94-
if ( empty($err_code) ) {
94+
if ( $err_code === -1 ) {
9595
phpCAS::trace($messages[] = 'Reason: no CAS error');
9696
} else {
9797
phpCAS::trace($messages[] = 'Reason: ['.$err_code.'] CAS error: '.$err_msg);

0 commit comments

Comments
 (0)