/** * Ensure an array has all the needed fields for a specific type * * @since 1.1.0 * * @param array $data * * @return bool */ public static function valid($data) { if (parent::valid($data)) { if ('price' == $data['type']) { return isset($data['meta']['product_ID']) && is_numeric($data['meta']['product_ID']); } return true; } }
/** * Ensure array has all the needed fields for a variant * * @since 1.1.0 * * @param array $data * * @return bool */ public static function valid($data) { if (false == parent::valid($data)) { return false; } if ('price' == $data['type']) { return isset($data['meta']['price']) && is_numeric($data['content']); } return true; }