createTokenMessage($token, $expectedTypesOrMessage); parent::__construct($message); } private function createTokenMessage(array $token, array $valid) { return sprintf( 'Expected one of the following: %s; found %s "%s"', implode(', ', array_keys($valid)), $token['type'], $token['value'] ); } }