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/Modules/News/NewsSource.php

    r878 r887  
    11<?php
    22
    3 function GetTextBetween(&$Text, $Start, $End)
     3function GetTextBetween(string &$Text, string $Start, string $End): string
    44{
    55  $Result = '';
     
    3434}
    3535
    36 function HumanDateTimeToTime($DateTime)
     36function HumanDateTimeToTime(string $DateTime): int
    3737{
    3838  if ($DateTime == '') return NULL;
     
    4949}
    5050
    51 function HumanDateToTime($Date)
     51function HumanDateToTime(string $Date): int
    5252{
    5353  if ($Date == '') return NULL;
     
    5555}
    5656
    57 function GetUrlBase($Url)
     57function GetUrlBase(string $Url): string
    5858{
    5959  $Result = parse_url($Url);
     
    6363class NewsSources
    6464{
    65   public $Database;
     65  public Database $Database;
    6666
    6767  function Parse($Id = null)
     
    9494class NewsSource
    9595{
    96   public $Name;
    97   public $URL;
     96  public string $Name;
     97  public string $URL;
    9898  public $Method;
    99   public $Id;
    100   public $Database;
    101   public $NewsItems;
    102   public $AddedCount;
     99  public int $Id;
     100  public Database $Database;
     101  public array $NewsItems;
     102  public int $AddedCount;
    103103  public $Category;
    104104
     
    109109  }
    110110
    111   function Import()
     111  function Import(): string
    112112  {
    113113    return '';
    114114  }
    115115
    116   function DoImport()
     116  function DoImport(): string
    117117  {
    118118    $this->NewsItems = array();
     
    133133class NewsItem
    134134{
    135   var $Database;
    136   var $Title = '';
    137   var $Content = '';
    138   var $Date = '';
    139   var $Link = '';
    140   var $Category = '';
    141   var $Author = '';
    142   var $IP = '';
    143   var $Enclosure = '';
     135  public Database $Database;
     136  public string $Title = '';
     137  public string $Content = '';
     138  public int $Date = 0;
     139  public string $Link = '';
     140  public string $Category = '';
     141  public string $Author = '';
     142  public string $IP = '';
     143  public string $Enclosure = '';
    144144
    145   function AddIfNotExist()
     145  function AddIfNotExist(): int
    146146  {
    147147    $Where = '(`Title` = "'.$this->Database->real_escape_string($this->Title).'") AND '.
Note: See TracChangeset for help on using the changeset viewer.