'array', 'items' => array( 'type' => 'integer', 'minimum' => 1, 'maximum' => 7, ), ); } /** * Gets the default value for a newly created condition of this type. * * @return mixed */ public function default_value() { return array( 1, 2, 3, 4, 5 ); } /** * Evaluates the condition against the given context. * * @param Context $context Request context value object. * @param string $operator Operator identifier. * @param mixed $value Configured value. * @return bool */ public function evaluate( Context $context, string $operator, $value ): bool { $days = array_map( 'intval', is_array( $value ) ? $value : array( $value ) ); $today = (int) $context->datetime->format( 'N' ); $in = in_array( $today, $days, true ); return 'not_in' === $operator ? ! $in : $in; } }