API Documentation for: 1.1.1
Show:

TimeService Class

Extends Service
Namespace: Canteen\Services

Service for getting the time off the server. Located in the namespace Canteen\Services.

Methods

bindObject

(
  • data
  • dataClass
  • [prepends=null]
  • [useFirstRow=true]
)
Mixed protected

Inherited from Service:

Bind an associate array to a data object

Parameters:

  • data Array

    The data to bind

  • dataClass String

    The name of the data class (string to bind)

  • [prepends=null] Array optional

    The array of maps to prepend to the variables used for prepending a path or directory to a file/path/url

  • [useFirstRow=true] Boolean optional

    If to just return the row in a return, only getting one item from a mysql array call

Returns:

Mixed:

The typed data object

bindObjects

(
  • data
  • dataClass
  • [prepends=null]
)
Array protected

Inherited from Service:

Same as bindObject but done on a whole collection

Parameters:

  • data Array

    The data to bind

  • dataClass String

    The name of the data class (string to bind)

  • [prepends=null] Array optional

    The array of maps to prepend to the variables used for prepending a path or directory to a file/path/url

Returns:

Array:

The data object

gateway

(
  • uri
  • method
  • [privilege=Privilege::ANONYMOUS]
)
Service

Inherited from Service:

Add for use on the Gateway, these methods can be called from javascript. For an example see the TimeService class.

Parameters:

  • uri String

    The URI path to call from the gateway

  • method String

    The name of the method

  • [privilege=Privilege::ANONYMOUS] Int optional

    The minimum privilege needed for the client to access this method.

Returns:

Service:

Return the instance of this for chaining

getCaller

(
  • [ignore=1]
)
String | Array protected

Inherited from Service:

Get the method/function name of the caller function

Parameters:

  • [ignore=1] Int optional

    The depth of the call, default is the immediate function before this one is called

Returns:

String | Array:

The name of the method

getServerTime

() Int

Get the local server time when a more reliable time is needed than the client time

Returns:

Int:

The number of UNIX seconds since Jan. 1, 1970

getStack

(
  • [limit=0]
  • [ignore=1]
)
String | Array protected

Inherited from Service:

Get the method/function name of the caller function

Parameters:

  • [limit=0] Int optional

    The number of stack items to return, default is all

  • [ignore=1] Int optional

    The number of stack levesl to ignore, default is the immediate function before this one is called.

Returns:

String | Array:

The name of the method or full trace

parse

(
  • content
  • substitutions
)
String protected

Inherited from CanteenBase

Convenience method for parsing content

Parameters:

  • content String

    The string to parse

  • substitutions Dictionary

    The dictionary of tags to replace

Returns:

String:

The parsed string

privilege

(
  • [required=Privilege::GUEST]
)
protected

Inherited from Service:

You can run to make sure a process requires a particular privilege

Parameters:

  • [required=Privilege::GUEST] Int optional

    The privilege level required, default is anonymous

service

(
  • alias
)
Service protected

Inherited from CanteenBase:

Get a service by alias

Parameters:

Returns:

Service:

The service matching the alias

template

(
  • name
  • [substitutions=[]
)
String protected

Inherited from CanteenBase:

Convenience method for parsing content

Parameters:

  • name String

    The name of the template to parse

  • [substitutions=[] Dictionary optional

    The dictionary of tags to replace

Returns:

String:

The parsed string

valueSet

(
  • A
  • [validationType=null]
)
String protected

Inherited from Service:

Get a set of ids

Parameters:

  • A Array | String

    single id or a collection of IDs

  • [validationType=null] RegExp optional

    See Validation class for more information on types

Returns:

String:

The MySQL formatted set of IDs

verify

(
  • data
  • [type=null]
  • [suppressErrors=false]
)
Mixed protected

Inherited from Service:

Sanitize input data using the validation types above

Parameters:

  • data String

    The data to be validated, can be an array of items

  • [type=null] RegExp optional

    The type of validation, defaults to Numeric. Can also be an array set of items

  • [suppressErrors=false] Boolean optional

    If we should suppress throwing errors

Returns:

Mixed:

If we don't verify and suppress errors, returns false, else returns the data

Properties

alias

String

Inherited from Service:

The name of the service alias

cache

ServerCache

Inherited from CanteenBase:

Get the instance of the site cache

db

Database

Inherited from Service:

Convenience getter for the database connection

mappings

Array private

Inherited from Service:

The mappings used to prepend the data object paths

parser

Parser

Inherited from CanteenBase:

The parser is responsible for rendering templates

profiler

Profiler

Inherited from CanteenBase:

The instance of the profiler for debugging performance

settings

SettingsManager

Inherited from CanteenBase:

Get the instance of the settings manager

site

Site

Inherited from CanteenBase:

Convenience getter for the site

user

Authorization

Inherited from CanteenBase:

Get the Authorization class to handle things like login, password change