FusionDirectory
class_exceptions.inc
Go to the documentation of this file.
1 <?php
2 /*
3  This code is part of FusionDirectory (http://www.fusiondirectory.org/)
4  Copyright (C) 2015-2016 FusionDirectory
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program; if not, write to the Free Software
18  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20 
30 {
31  public function toArray (): array
32  {
33  return [
34  'class' => get_class($this),
35  'message' => $this->getMessage(),
36  'line' => $this->getLine(),
37  'file' => $this->getFile(),
38  ];
39  }
40 }
41 
46 {
47 }
48 
53 {
54 }
55 
60 {
61 }
62 
67 {
68 }
69 
71 {
72  protected $type;
73 
74  public function __construct (string $type, int $code = 0, Throwable $previous = NULL)
75  {
76  $this->type = $type;
77 
78  parent::__construct(sprintf(_('Non-existing type "%s"!'), $this->type), $code, $previous);
79  }
80 
81  public function toArray (): array
82  {
83  $array = parent::toArray();
84 
85  $array['type'] = $this->type;
86 
87  return $array;
88  }
89 }
90 
92 {
93  protected $branch;
94 
95  public function __construct (string $branch, int $code = 0, Throwable $previous = NULL)
96  {
97  $this->branch = $branch;
98 
99  parent::__construct(sprintf(_('Non-existing branch "%s"!'), $this->branch), $code, $previous);
100  }
101 
102  public function toArray (): array
103  {
104  $array = parent::toArray();
105 
106  $array['branch'] = $this->branch;
107 
108  return $array;
109  }
110 }
111 
113 {
114  protected $dn;
115 
116  public function __construct (string $dn, string $message = NULL, int $code = 0, Throwable $previous = NULL)
117  {
118  $this->dn = $dn;
119  if ($message === NULL) {
120  $message = sprintf(_('Non-existing dn "%s"!'), $this->dn);
121  }
122 
123  parent::__construct($message, $code, $previous);
124  }
125 
126  public function toArray (): array
127  {
128  $array = parent::toArray();
129 
130  $array['dn'] = $this->dn;
131 
132  return $array;
133  }
134 }
135 
137 {
138  public function __construct (string $message = "", int $code = 0, Throwable $previous = NULL)
139  {
140  if ($message === '') {
141  $message = _('Filter is empty');
142  }
143  parent::__construct($message, $code, $previous);
144  }
145 }
146 
148 {
149 }
150 
152 {
153  protected $class;
154 
155  public function __construct (string $class, int $code = 0, Throwable $previous = NULL)
156  {
157  $this->class = $class;
158 
159  parent::__construct(sprintf(_('Unknown class "%s"!'), $this->class), $code, $previous);
160  }
161 
162  public function toArray (): array
163  {
164  $array = parent::toArray();
165 
166  $array['unknownclass'] = $this->class;
167 
168  return $array;
169  }
170 }
171 
173 {
174 }
175 
177 {
178 }
179 
181 {
182 }
Exception class which can be thrown if an attribute is set to a value with a non-compatible type...
Exception class which can be thrown by LdapGeneralizedTime if the format does not match...
Parent class for all exceptions thrown in FusionDirectory.
Exception class which can be thrown by LDAP class if LDIF export fails.
Exception class which can be thrown by LDAP if the LDIF format is broken.