# \Object_Sync_Sf_Schedule

Schedule events in a queue in WordPress

## Summary

Methods
Properties
Constants
__construct()
add_actions()
set_schedule_frequency()
get_schedule_frequency_key()
get_schedule_frequency_seconds()
use_schedule()
maybe_handle()
cancel_by_name()
count_queue_items()
No public properties found
No constants found
task()
check_for_data()
complete()
$wpdb
$version
$login_credentials
$slug
$wordpress
$salesforce
$mappings
$schedule_name
$logging
N/A
No private methods found
No private properties found
N/A

File
  classes/schedule.php
Package
  Default
Class hierarchy
  \Object_Sync_Sf_Schedule

## Tags

None found

## Properties

### $wpdb

    $wpdb :

#### Type

#

## Tags

None found

### $version

    $version :

#### Type

#

## Tags

None found

### $login_credentials

    $login_credentials :

#### Type

#

## Tags

None found

### $slug

    $slug :

#### Type

#

## Tags

None found

### $wordpress

    $wordpress :

#### Type

#

## Tags

None found

### $salesforce

    $salesforce :

#### Type

#

## Tags

None found

### $mappings

    $mappings :

#### Type

#

## Tags

None found

### $schedule_name

    $schedule_name :

#### Type

#

## Tags

None found

### $logging

    $logging :

#### Type

#

## Tags

None found

## Methods

### __construct()

    __construct(object  $wpdb, string  $version, array  $login_credentials, string  $slug, object  $wordpress, object  $salesforce, object  $mappings, string  $schedule_name,   $logging,   $schedulable_classes)

Constructor which sets up schedule and handler for when schedule runs

#### Parameters

object | $wpdb |
string | $version |
array | $login_credentials |
string | $slug |
object | $wordpress |
object | $salesforce |
object | $mappings |
string | $schedule_name |
| $logging |
| $schedulable_classes |

#### Throws

\Exception

#

## Tags

None found

### add_actions()

    add_actions()

Create the actions to run

#

## Tags

None found

### set_schedule_frequency()

    set_schedule_frequency(  $schedules)

Convert the schedule frequency from the admin settings into an array interval must be in seconds for the class to use it

#### Parameters

| $schedules |

#

## Tags

None found

### get_schedule_frequency_key()

    get_schedule_frequency_key(  $name = '')

Convert the schedule frequency from the admin settings into an array interval must be in seconds for the class to use it

#### Parameters

| $name |

#

## Tags

None found

### get_schedule_frequency_seconds()

    get_schedule_frequency_seconds(  $name = '')

Convert the schedule frequency from the admin settings into seconds

#### Parameters

| $name |

#

## Tags

None found

### use_schedule()

    use_schedule(  $name = '') : void

Schedule function This creates and manages the scheduling of the task

#### Parameters

| $name |

#

## Tags

None found

### maybe_handle()

    maybe_handle(  $already_checked = false,   $ajax = false)

Maybe process queue

Checks whether data exists within the queue and that the process is not already running.

#### Parameters

| $already_checked |
| $ajax |

#

## Tags

None found

### cancel_by_name()

    cancel_by_name(  $name)

Method to cancel a specific queue by its name

This is modeled off the cancel_process method in wp-background-process but that one doesn't seem to work when we need to specify the queue name

#### Parameters

| $name |

#

## Tags

None found

### count_queue_items()

    count_queue_items(  $schedule_name = '') : boolean

How many items are in this queue? Based on is_queue_empty from base library

#### Parameters

| $schedule_name |

#### Returns

boolean

#

## Tags

None found

### task()

    task(mixed  $data) : mixed

Task

Override this method to perform any actions required on the queue data. Return the modified data for further processing in the next pass through. Or, return false to remove the data from the queue.

#### Parameters

mixed | $data | Queue data to iterate over

#### Returns

mixed

#

## Tags

None found

### check_for_data()

    check_for_data() : \$data

Check for data

This method is new to the extension. It allows a scheduled method to do nothing but call the callback parameter of its calling class. This is useful for running the salesforce_pull event to check for updates in Salesforce

#### Returns

\$data

#

## Tags

None found

### complete()

    complete()

Complete

Override if applicable, but ensure that the below actions are performed, or, call parent::complete().

#

## Tags

None found

### schedule.php