@@ -44,6 +44,11 @@ private function __construct(array $checkers, array $tokenTypes)
4444 }
4545
4646 /**
47+ * This method creates the HeaderCheckerManager.
48+ * The first argument is a list of header parameter checkers objects.
49+ * The second argument is a list of token type support objects.
50+ * It is recommended to support only one token type per manager.
51+ *
4752 * @param HeaderChecker[] $checkers
4853 * @param TokenTypeSupport[] $tokenTypes
4954 *
@@ -55,6 +60,8 @@ public static function create(array $checkers, array $tokenTypes): self
5560 }
5661
5762 /**
63+ * This method returns all checkers handled by this manager.
64+ *
5865 * @return HeaderChecker[]
5966 */
6067 public function getCheckers (): array
@@ -88,18 +95,22 @@ private function add(HeaderChecker $checker): self
8895 }
8996
9097 /**
98+ * This method checks all the header parameters passed as argument.
99+ * All header parameters are checked against the header parameter checkers.
100+ * If one fails, the InvalidHeaderException is thrown.
101+ *
91102 * @param JWT $jwt
92- * @param int $component
103+ * @param int $index
93104 *
94105 * @throws InvalidHeaderException
95106 */
96- public function check (JWT $ jwt , int $ component )
107+ public function check (JWT $ jwt , int $ index )
97108 {
98109 foreach ($ this ->tokenTypes as $ tokenType ) {
99110 if ($ tokenType ->supports ($ jwt )) {
100111 $ protected = [];
101112 $ unprotected = [];
102- $ tokenType ->retrieveTokenHeaders ($ jwt , $ component , $ protected , $ unprotected );
113+ $ tokenType ->retrieveTokenHeaders ($ jwt , $ index , $ protected , $ unprotected );
103114 $ this ->checkDuplicatedHeaderParameters ($ protected , $ unprotected );
104115 $ this ->checkHeaders ($ protected , $ unprotected );
105116
0 commit comments