• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thecodingmachine / magic-query / 15536904331

09 Jun 2025 02:25PM UTC coverage: 70.243%. First build
15536904331

push

github

homersimpsons
:construction_worker: Upgrade CI dependencies and activation

1100 of 1566 relevant lines covered (70.24%)

4.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Mouf/Database/QueryWriter/Utils/DbHelper.php
1
<?php
2

3
namespace Mouf\Database\QueryWriter\Utils;
4

5
use Doctrine\DBAL\Connection;
6
use Mouf\MoufManager;
7

8
class DbHelper
9
{
10
    public static function getAll(string $sql, ?int $offset, ?int $limit)
11
    {
12
        /** @var Connection $dbalConnection */
13
        $dbalConnection = MoufManager::getMoufManager()->get('dbalConnection');
×
14
        $sql .= self::getFromLimitString($offset, $limit);
×
15
        $statement = $dbalConnection->executeQuery($sql);
×
16
        $results = $statement->fetchAll();
×
17

18
        $array = [];
×
19

20
        foreach ($results as $result) {
×
21
            $array[] = $result;
×
22
        }
23

24
        return $array;
×
25
    }
26

27
    public static function getFromLimitString(?int $from = null, ?int $limit = null): string
28
    {
29
        if ($limit !== null) {
×
30
            $queryStr = ' LIMIT '.$limit;
×
31

32
            if ($from !== null) {
×
33
                $queryStr .= ' OFFSET '.$from;
×
34
            }
35

36
            return $queryStr;
×
37
        } else {
38
            return '';
×
39
        }
40
    }
41
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc