src/MediawikiSession.php
public function getToken( $type = 'csrf' ) {
		// If we don't already have the token that we want
		if ( !array_key_exists( $type, $this->tokens ) ) {
			$this->logger->log( LogLevel::DEBUG, 'Getting fresh token', [ 'type' => $type ] );

			// If we know that we don't have the new module mw<1.25
			if ( $this->usePre125TokensModule ) {
				return $this->reallyGetPre125Token( $type );
			} else {
				return $this->reallyGetToken( $type );
			}

		}

		return $this->tokens[$type];
	}
public function getToken( $type = 'csrf' ) {
		// If we don't already have the token that we want
		if ( !array_key_exists( $type, $this->tokens ) ) {
			$this->logger->log( LogLevel::DEBUG, 'Getting fresh token', [ 'type' => $type ] );

			// If we know that we don't have the new module mw<1.25
			if ( $this->usePre125TokensModule ) {
				return $this->reallyGetPre125Token( $type );
			} else {
				return $this->reallyGetToken( $type );
			}

		}

		return $this->tokens[$type];
	}
public function getToken ( $ type = 'csrf' ) { // If we don't already have the token that we want if ( ! array_key_exists ( $ type , $ this -> tokens ) ) { $ this -> logger -> log ( LogLevel :: DEBUG , 'Getting fresh token' , [ 'type' => $ type ] ) ; // If we know that we don't have the new module mw<1.25 if ( $ this -> usePre125TokensModule ) { return $ this -> reallyGetPre125Token ( $ type ) ; } else { return $ this -> reallyGetToken ( $ type ) ; } } return $ this -> tokens [ $ type ] ; }
Tries to get the specified token from the API

@since 0.1

@param string $type The type of token to get.

@return string
Tries to get the specified token from the API