AppNotFoundException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 2
1
<?php
2
3
// -------------------------------------------------------------------------
4
// OVIDENTIA http://www.ovidentia.org
5
// Ovidentia is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 2, or (at your option)
8
// any later version.
9
//
10
// This program is distributed in the hope that it will be useful, but
11
// WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
// See the GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18
// USA.
19
// -------------------------------------------------------------------------
20
/**
21
 * @license http://opensource.org/licenses/gpl-license.php GNU General Public License (GPL)
22
 * @copyright Copyright (c) 2022 by SI4YOU ({@link https://www.siforyou.com})
23
 */
24
namespace Capwelton\LibApp\Exceptions;
25
26
use Capwelton\LibOrm\ORMRecordSet;
0 ignored issues
show
Bug introduced by
The type Capwelton\LibOrm\ORMRecordSet was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
28
/**
29
 * AppNotFoundException are thrown when the user tries to
30
 * access a non-existent app object using the request() method.
31
 *
32
 * @see \app_RecordSet::request()
33
 *
34
 * @since 1.0.18
35
 */
36
class AppNotFoundException extends AppException
37
{
38
    
39
    private $recordSet = null;
40
    
41
    private $id = null;
42
    
43
    /**
44
     * @param ORMRecordSet $recordSet
45
     * @param string $id
46
     */
47
    public function __construct(ORMRecordSet $recordSet, $id)
48
    {
49
        $this->recordSet = $recordSet;
50
        $this->id = $id;
51
    }
52
    
53
    /**
54
     * @return ORMRecordSet
55
     */
56
    public function getRecordSet()
57
    {
58
        return $this->recordSet;
59
    }
60
    
61
    /**
62
     * @return string
63
     */
64
    public function getId()
65
    {
66
        return $this->id;
67
    }
68
    
69
    /**
70
     * Get the set description and translate
71
     *
72
     * @return string
73
     */
74
    public function getObjectTitle()
75
    {
76
        $element = app_translate('object');
77
        if($description = $this->getRecordSet()->getDescription()){
78
            $element = mb_strtolower(app_translate($description));
79
        }
80
        
81
        return $element;
82
    }
83
}