Skip to content
Snippets Groups Projects

Ptps controller 6

Merged Адлан Шамавов requested to merge PTPS_Controller_6 into main
4 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
9 13 class HomeController extends AbstractController
10 14 {
11 private function sortPrice(array $array): array
15 private Functions $functions;
16
17 public function __construct(Functions $functions)
12 18 {
13 $price = [];
14 $count = [];
15 foreach ($array as $key => $row) {
16 $price[$key] = $row['price'];
17 $count[$key] = $row['count'];
18 }
19 array_multisort($price, SORT_DESC, $count, SORT_ASC, $array);
20 return $array;
19 $this->functions = $functions;
  • 62 }
    63
    64 #[Route('/func5/{day}/{month}/{year}', name: 'func5')]
    65 public function func5(int $day, int $month, int $year): Response
    66 {
    67 $dateAsString = $year . "-" . $month . "-" . $day;
    68 try {
    69 $result = $this->functions->howDaysToNy(new DateTimeImmutable($dateAsString));
    70 } catch (\Exception $e) {
    71 return new Response($e->getMessage());
    72 }
    73 return $this->json(["Days before NY:" => $result]);
    74 }
    75
    76 #[Route('/func6/{year}', name: 'func6', methods: ['GET'])]
    77 public function func6(int $year): Response
  • 66 {
    67 $dateAsString = $year . "-" . $month . "-" . $day;
    68 try {
    69 $result = $this->functions->howDaysToNy(new DateTimeImmutable($dateAsString));
    70 } catch (\Exception $e) {
    71 return new Response($e->getMessage());
    72 }
    73 return $this->json(["Days before NY:" => $result]);
    74 }
    75
    76 #[Route('/func6/{year}', name: 'func6', methods: ['GET'])]
    77 public function func6(int $year): Response
    78 {
    79 $fridays = array();
    80 try {
    81 foreach ($this->functions->countFriday13($year) as $date) {
  • added 2 commits

    Compare with previous version

  • added 4 commits

    Compare with previous version

  • 60 )]
    61 public function howDaysToNy(int $day, int $month, int $year): Response
    62 {
    63 $dateAsString = $year . "-" . $month . "-" . $day;
    64 try {
    65 $result = $this->functions->howDaysToNy(new DateTimeImmutable($dateAsString));
    66 } catch (\Exception $e) {
    67 return new Response($e->getMessage());
    68 }
    69 return $this->json(["Days before NY:" => $result]);
    70 }
    71
    72 #[Route(
    73 '/countFriday13/{year}',
    74 name: 'countFriday13',
    75 requirements: ['year' => '(?<!-)(?<!\d)\d+'],
  • added 2 commits

    Compare with previous version

  • added 6 commits

    Compare with previous version

  • added 13 commits

    Compare with previous version

  • added 12 commits

    • ac4beafa...2de0012a - 6 commits from branch main
    • da409f72 - Merge branch 'main' into 'PTPS_Controller_5'
    • 7ef5f025 - Merge branch 'PTPS_Controller_5' of...
    • cd069166 - Merge branch 'PTPS_Controller_5' of...
    • ea083e60 - Merge branch 'PTPS_Controller_5' of...
    • e628f172 - Merge branch 'PTPS_Controller_5' into PTPS_Controller_6
    • a36bd71e - Merge branch 'PTPS_Controller_6' of...

    Compare with previous version

  • mentioned in commit ca9bf67d

  • Please register or sign in to reply
    Loading