Update
        
        extends Shift
    
    
            
            in package
            
        
    
    
    
Shifts Update class
Table of Contents
Constants
- ERR_EMPTY_ARRAY = -2
 - ERR_EMPTY_RESULT = -1
 - ERR_INVALID_DATA = -3
 - OK_UPDATE = 1
 
Properties
Methods
- __construct() : mixed
 - __destruct() : mixed
 - getIterator() : array<string|int, mixed>
 - Iterate over shifts found
 - response() : array<string|int, mixed>
 - Fetch server response
 - update() : int
 - Send shifts to collettore unico this method receive an array an send a valid json to collettore unico
 - dateIsValid() : bool
 - Checks if date is valid
 - idShifterIsValid() : bool
 - Checks if idShifter format is valid
 - idShiftIsValid() : bool
 - Checks if idShift format is valid
 - keysAreValids() : bool
 - Checks if array keys are all valid AND all must be present
 - shiftsAreValid() : bool
 - Checks if array of shifts are all valid
 
Constants
ERR_EMPTY_ARRAY
    public
        mixed
    ERR_EMPTY_ARRAY
    = -2
    
    
    
    
ERR_EMPTY_RESULT
    public
        mixed
    ERR_EMPTY_RESULT
    = -1
    
    
    
    
ERR_INVALID_DATA
    public
        mixed
    ERR_INVALID_DATA
    = -3
    
    
    
    
OK_UPDATE
    public
        mixed
    OK_UPDATE
    = 1
    
    
    
    
Properties
$authUrl
        protected
            string
    $authUrl
     = ''
    
    
    
    
    
$data
        protected
            array<string|int, mixed>
    $data
    
    
    
    
    
    
$routeUrl
        protected
            string
    $routeUrl
     = ''
    
    
    
    
    
Methods
__construct()
    public
                    __construct(string $proto, string $fqdn, int $port, string $auth) : mixed
    Parameters
- $proto : string
 - $fqdn : string
 - $port : int
 - $auth : string
 
__destruct()
    public
                    __destruct() : mixed
    getIterator()
Iterate over shifts found
    public
                    getIterator() : array<string|int, mixed>
    Return values
array<string|int, mixed> —found Data
response()
Fetch server response
    public
                    response() : array<string|int, mixed>
    Return values
array<string|int, mixed> —( [status] => %s [code] => %d [idlog] => %d [numRows] => %d)
update()
Send shifts to collettore unico this method receive an array an send a valid json to collettore unico
    public
                    update(array<string|int, mixed> $shifts) : int
    Parameters
- $shifts : array<string|int, mixed>
 
Return values
int —Results code (see constants)
dateIsValid()
Checks if date is valid
    private
                    dateIsValid(string $day) : bool
    Parameters
- $day : string
 
Return values
bool —True, date is valid, False otherwise
idShifterIsValid()
Checks if idShifter format is valid
    private
                    idShifterIsValid(string $idShifter) : bool
    Parameters
- $idShifter : string
 - 
                    
Check only if idShifter is valid (match this regexp /^[A-Z]{6}[0-9]{6}/)
 
Return values
bool —True, date is valid, False otherwise
idShiftIsValid()
Checks if idShift format is valid
    private
                    idShiftIsValid(int $idShift) : bool
    Parameters
- $idShift : int
 - 
                    
Check only if idShift format is valud (is numeric and is integer)
 
Return values
bool —True, date is valid, False otherwise
keysAreValids()
Checks if array keys are all valid AND all must be present
    private
                    keysAreValids(array<string|int, mixed> $validKeys, array<string|int, mixed> $receivedKeys) : bool
    Parameters
- $validKeys : array<string|int, mixed>
 - 
                    
array of valid keys name
 - $receivedKeys : array<string|int, mixed>
 - 
                    
array of keys to check
 
Return values
bool —True, keys are valid, False otherwise
shiftsAreValid()
Checks if array of shifts are all valid
    private
                    shiftsAreValid(array<string|int, mixed> $shifts) : bool
    Parameters
- $shifts : array<string|int, mixed>
 
Return values
bool —True, shifts are ALL valid, False if at-least one is invalid (and stop checking the followings)