1+ <?php declare (strict_types=1 );
2+ /*
3+ * Copyright 2023 Bastian Schwarz <bastian@codename-php.de>.
4+ *
5+ * Licensed under the Apache License, Version 2.0 (the "License");
6+ * you may not use this file except in compliance with the License.
7+ * You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
17+
18+ namespace de \codenamephp \deploymentchecks \http \Check \Result ;
19+
20+ use de \codenamephp \deploymentchecks \base \Check \Result \Collection \ResultCollection ;
21+ use de \codenamephp \deploymentchecks \base \Check \Result \Collection \ResultCollectionInterface ;
22+ use de \codenamephp \deploymentchecks \base \Check \Result \ResultInterface ;
23+ use de \codenamephp \deploymentchecks \base \Check \Result \WithNameInterface ;
24+
25+ final readonly class HttpCheckResult implements ResultCollectionInterface, WithNameInterface {
26+
27+ public ResultCollectionInterface $ testResults ;
28+
29+ public function __construct (public string $ name , ResultInterface ...$ testResults ) {
30+ $ this ->testResults = new ResultCollection (...$ testResults );
31+ }
32+
33+ public function add (ResultInterface $ result ) : self {
34+ $ this ->testResults ->add ($ result );
35+ return $ this ;
36+ }
37+
38+ public function successful () : bool {
39+ return $ this ->testResults ->successful ();
40+ }
41+
42+ public function name () : string {
43+ return $ this ->name ;
44+ }
45+ }
0 commit comments