CronIntervalSniff
extends Sniff
in package
Flag cron schedules less than 15 minutes.
Tags
Table of Contents
Properties
- $min_interval : int
- Minimum allowed cron interval in seconds.
- $phpcsFile : File
- The current file being sniffed.
- $tokens : array<string|int, mixed>
- The list of tokens in the current file being sniffed.
- $valid_functions : array<string|int, mixed>
- Function within which the hook should be found.
- $wp_time_constants : array<string|int, mixed>
- Known WP Time constant names and their value.
Methods
- confused() : void
- Add warning about unclear cron schedule change.
- process() : int|void
- Set sniff properties and hand off to child class for processing of the token.
- process_token() : void
- Processes this test, when one of its tokens is encountered.
- register() : array<string|int, mixed>
- Returns an array of tokens this test wants to listen for.
- find_function_by_name() : int|false
- Find a declared function in a file based on the function name.
Properties
$min_interval
Minimum allowed cron interval in seconds.
public
int
$min_interval
= 900
Defaults to 900 (= 15 minutes), which is the requirement for the VIP platform.
Tags
$phpcsFile
The current file being sniffed.
protected
File
$phpcsFile
Tags
$tokens
The list of tokens in the current file being sniffed.
protected
array<string|int, mixed>
$tokens
Tags
$valid_functions
Function within which the hook should be found.
protected
array<string|int, mixed>
$valid_functions
= array('add_filter' => true)
$wp_time_constants
Known WP Time constant names and their value.
protected
array<string|int, mixed>
$wp_time_constants
= array('MINUTE_IN_SECONDS' => 60, 'HOUR_IN_SECONDS' => 3600, 'DAY_IN_SECONDS' => 86400, 'WEEK_IN_SECONDS' => 604800, 'MONTH_IN_SECONDS' => 2592000, 'YEAR_IN_SECONDS' => 31536000)
Tags
Methods
confused()
Add warning about unclear cron schedule change.
public
confused(int $stackPtr) : void
Parameters
- $stackPtr : int
-
The position of the current token in the stack.
process()
Set sniff properties and hand off to child class for processing of the token.
public
process(File $phpcsFile, int $stackPtr) : int|void
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
Tags
Return values
int|void —Integer stack pointer to skip forward or void to continue normal file processing.
process_token()
Processes this test, when one of its tokens is encountered.
public
process_token(int $stackPtr) : void
Parameters
- $stackPtr : int
-
The position of the current token in the stack.
register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, mixed>
Return values
array<string|int, mixed>find_function_by_name()
Find a declared function in a file based on the function name.
private
find_function_by_name(string $functionName) : int|false
Parameters
- $functionName : string
-
The name of the function to find.
Return values
int|false —Integer stack pointer to the function keyword token or false if not found.