Skip to content

Commit f4fa2c6

Browse files
committed
Updated project to use nested resources
1 parent 122b1d5 commit f4fa2c6

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

tests/resources/Project.php

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
namespace Example\Client\Resource;
44

5+
use WyriHaximus\ApiClient\Annotations\Nested;
56
use WyriHaximus\ApiClient\Resource\TransportAwareTrait;
67

8+
/**
9+
* @Nested(build="Project\Build", config="Project\Config")
10+
*/
711
abstract class Project implements ProjectInterface
812
{
913
use TransportAwareTrait;
@@ -24,9 +28,14 @@ abstract class Project implements ProjectInterface
2428
protected $description;
2529

2630
/**
27-
* @var array
31+
* @var Project\Build
2832
*/
29-
protected $config = array();
33+
protected $build;
34+
35+
/**
36+
* @var Project\Config
37+
*/
38+
protected $config;
3039

3140
/**
3241
* @var SplObjectStorage
@@ -68,9 +77,17 @@ public function description() : string
6877
}
6978

7079
/**
71-
* @return array
80+
* @return Project\Build
81+
*/
82+
public function build() : Project\Build
83+
{
84+
return $this->build;
85+
}
86+
87+
/**
88+
* @return Project\Config
7289
*/
73-
public function config() : array
90+
public function config() : Project\Config
7491
{
7592
return $this->config;
7693
}

tests/resources/ProjectInterface.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ public function name() : string;
2222
public function description() : string;
2323

2424
/**
25-
* @return array
25+
* @return Project\Build
2626
*/
27-
public function config() : array;
27+
public function build() : Project\Build;
28+
29+
/**
30+
* @return Project\Config
31+
*/
32+
public function config() : Project\Config;
2833

2934
/**
3035
* @return SplObjectStorage

tests/yaml/project.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
namespace: Example\Client\Resource
22
class: Project
3+
nested:
4+
build: Project\Build
5+
config: Project\Config
36
properties:
47
id: int
58
name: string
69
description: string
7-
config:
8-
type: array
9-
default: []
10+
build: Project\Build
11+
config: Project\Config
1012
plugins: SplObjectStorage
1113
created: DateTimeInterface
1214
updated: DateTimeInterface

0 commit comments

Comments
 (0)