Ignore:
Timestamp:
Nov 20, 2020, 12:08:12 AM (3 years ago)
Author:
chronos
Message:
  • Added: Static types added to almost all classes, methods and function. Supported by PHP 7.4.
  • Fixed: Various found code issues.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/Form/Types/Time.php

    r874 r887  
    55class TypeTime extends TypeBase
    66{
    7   var $DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>');
     7  function __construct(FormManager $FormManager)
     8  {
     9    parent::__construct($FormManager);
     10    $this->DatabaseCompareOperators = array('Rovno' => '=', 'Nerovno' => '!=', 'Menší' => '<', 'Větší' => '>');
     11  }
    812
    9   function OnView($Item)
     13  function OnView(array $Item): ?string
    1014  {
    1115    if ($Item['Value'] == 0) return '';
     
    1721  }
    1822
    19   function OnEdit($Item)
     23  function OnEdit(array $Item): string
    2024  {
    2125    if (($Item['Value'] == null) or (($Item['Value'] !== null) and ((strtolower($Item['Value']) == 'now') or (strtolower($Item['Value']) == ''))))
     
    2428      $IsNull = true;
    2529    } else $IsNull = false;
    26     $Parts = getdate($Item['Value']);
     30    $TimeParts = getdate($Item['Value']);
    2731
    2832    $Output = '';
     
    7074  }
    7175
    72   function OnLoad($Item)
     76  function OnLoad(array $Item): ?string
    7377  {
    7478    if (!array_key_exists($Item['Name'].'-null', $_POST) and array_key_exists('Null', $Item) and ($Item['Null'] == true)) return null;
     
    7680  }
    7781
    78   function OnLoadDb($Item)
     82  function OnLoadDb(array $Item): ?string
    7983  {
    8084    return MysqlTimeToTime($Item['Value']);
    8185  }
    8286
    83   function OnSaveDb($Item)
     87  function OnSaveDb(array $Item): ?string
    8488  {
    8589    if ($Item['Value'] == null) return null;
     
    8791  }
    8892
    89   function DatabaseEscape($Value)
     93  function DatabaseEscape(string $Value): string
    9094  {
    9195    return '"'.addslashes($Value).'"';
Note: See TracChangeset for help on using the changeset viewer.