| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace phpnotify;
- /**
- * This class represents authorization method in the library.
- *
- * It represents authorization service, it may be overwrite by other class
- * which implements specified method, like user login or auth token.
- */
- abstract class authorization_method {
- /**
- * This return that authorization token is required or no.
- *
- * This is used to determinate that authorization header is required.
- * When it return true, then header would be added to the notify request.
- *
- * @return bool True when authorization token is required, false if not.
- */
- public abstract function is_header_required(): bool;
- /**
- * This return content of the authorization header.
- *
- * This return content of the authorization header, or null when header
- * is not required. Default return null.
- *
- * @return ?string Return content of the authorization header or null
- * when it is not required.
- */
- public function header_content(): string {
- return '';
- }
- /**
- * This return name of the authorization header.
- *
- * This return name of the authorization header. Default return
- * 'Authorization' which is standard name of that header. But it could
- * be changed by overwriting that function.
- *
- * @return string Name of the authorization header.
- */
- public function header_name(): string {
- return 'Authorization';
- }
- }
|