22
33namespace SimpleSAML \Module \authYubiKey \Auth \Source ;
44
5+ use Webmozart \Assert \Assert ;
6+
57/*
68 * Copyright (C) 2009 Andreas Åkre Solberg <andreas.solberg@uninett.no>
79 * Copyright (C) 2009 Simon Josefsson <simon@yubico.com>.
@@ -78,8 +80,8 @@ class YubiKey extends \SimpleSAML\Auth\Source
7880 */
7981 public function __construct ($ info , $ config )
8082 {
81- assert ( is_array ( $ info) );
82- assert ( is_array ( $ config) );
83+ Assert:: isArray ( $ info );
84+ Assert:: isArray ( $ config );
8385
8486 // Call the parent constructor first, as required by the interface
8587 parent ::__construct ($ info , $ config );
@@ -105,7 +107,7 @@ public function __construct($info, $config)
105107 */
106108 public function authenticate (&$ state )
107109 {
108- assert ( is_array ( $ state) );
110+ Assert:: isArray ( $ state );
109111
110112 // We are going to need the authId in order to retrieve this authentication source later
111113 $ state [self ::AUTHID ] = $ this ->authId ;
@@ -130,14 +132,14 @@ public function authenticate(&$state)
130132 */
131133 public static function handleLogin ($ authStateId , $ otp )
132134 {
133- assert ( is_string ( $ authStateId) );
134- assert ( is_string ( $ otp) );
135+ Assert:: string ( $ authStateId );
136+ Assert:: string ( $ otp );
135137
136138 /* Retrieve the authentication state. */
137139 $ state = \SimpleSAML \Auth \State::loadState ($ authStateId , self ::STAGEID );
138140
139141 /* Find authentication source. */
140- assert ( array_key_exists ( self ::AUTHID , $ state ) );
142+ Assert:: keyExists ( $ state , self ::AUTHID );
141143 $ source = \SimpleSAML \Auth \Source::getById ($ state [self ::AUTHID ]);
142144 if ($ source === null ) {
143145 throw new \Exception ('Could not find authentication source with id ' .$ state [self ::AUTHID ]);
@@ -195,7 +197,7 @@ public static function getYubiKeyPrefix($otp)
195197 */
196198 protected function login ($ otp )
197199 {
198- assert ( is_string ( $ otp) );
200+ Assert:: string ( $ otp );
199201
200202 require_once dirname (dirname (dirname (dirname (__FILE__ )))).'/libextinc/Yubico.php ' ;
201203
0 commit comments