Author: Andreas Möller (localheinz) Committer: GitHub (web-flow) Pusher: cmb69 Date: 2022-08-22T18:00:08+02:00
Commit: https://github.com/php/web-php/commit/c304829d218b7fc3103e04fb4b5951b1824bfd45 Raw diff: https://github.com/php/web-php/commit/c304829d218b7fc3103e04fb4b5951b1824bfd45.diff Enhancement: Enable and configure `class_attributes_separation` fixer Closes GH-643. Changed paths: M .php-cs-fixer.php M src/News/Entry.php M src/UserNotes/Sorter.php Diff: diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 4769fa7f7f..3aa55ae659 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -20,6 +20,7 @@ ->setRiskyAllowed(true) ->setRules([ 'array_indentation' => true, + 'class_attributes_separation' => true, 'constant_case' => true, 'indentation_type' => true, 'line_ending' => true, diff --git a/src/News/Entry.php b/src/News/Entry.php index 0d1ee07062..ebddb58f92 100755 --- a/src/News/Entry.php +++ b/src/News/Entry.php @@ -11,12 +11,19 @@ class Entry { ]; public const WEBROOT = "https://www.php.net"; + public const PHPWEB = __DIR__ . '/../../'; + public const ARCHIVE_FILE_REL = 'archive/archive.xml'; + public const ARCHIVE_FILE_ABS = self::PHPWEB . self::ARCHIVE_FILE_REL; + public const ARCHIVE_ENTRIES_REL = 'archive/entries/'; + public const ARCHIVE_ENTRIES_ABS = self::PHPWEB . self::ARCHIVE_ENTRIES_REL; + public const IMAGE_PATH_REL = 'images/news/'; + public const IMAGE_PATH_ABS = self::PHPWEB . self::IMAGE_PATH_REL; protected $title = ''; @@ -35,6 +42,7 @@ public function setTitle(string $title): self { $this->title = $title; return $this; } + public function setCategories(array $cats): self { foreach ($cats as $cat) { if (!isset(self::CATEGORIES[$cat])) { @@ -44,6 +52,7 @@ public function setCategories(array $cats): self { $this->categories = $cats; return $this; } + public function addCategory(string $cat): self { if (!isset(self::CATEGORIES[$cat])) { throw new \Exception("Unknown category: $cat"); @@ -57,10 +66,12 @@ public function addCategory(string $cat): self { public function isConference(): bool { return (bool)array_intersect($this->categories, ['cfp', 'conferences']); } + public function setConfTime(int $time): self { $this->conf_time = $time; return $this; } + public function setImage(string $path, string $title, ?string $link): self { if (basename($path) !== $path) { throw new \Exception('path must be a simple file name under ' . self::IMAGE_PATH_REL); @@ -75,6 +86,7 @@ public function setImage(string $path, string $title, ?string $link): self { ]; return $this; } + public function setContent(string $content): self { if (empty($content)) { throw new \Exception('Content must not be empty'); @@ -82,6 +94,7 @@ public function setContent(string $content): self { $this->content = $content; return $this; } + public function getId(): string { return $this->id; } @@ -165,6 +178,7 @@ public function updateArchiveXML(): self { return $this; } + private static function selectNextId(): string { $filename = date("Y-m-d", $_SERVER["REQUEST_TIME"]); $count = 0; diff --git a/src/UserNotes/Sorter.php b/src/UserNotes/Sorter.php index 6d4fa9be6c..9707a8dc90 100644 --- a/src/UserNotes/Sorter.php +++ b/src/UserNotes/Sorter.php @@ -4,15 +4,21 @@ class Sorter { private $maxVote; + private $minVote; + private $maxAge; + private $minAge; private $voteFactor; + private $ageFactor; private $voteWeight = 38; + private $ratingWeight = 60; + private $ageWeight = 2; public function sort(array &$notes) { -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php