Skip to content

Commit f79da09

Browse files
committed
simplifying
1 parent d3ec02a commit f79da09

32 files changed

+1430
-1030
lines changed

composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
}
2121
},
2222
"require": {
23-
"tmilos/value": "~2.0.1",
24-
"doctrine/collections": "^1.3"
2523
},
2624
"require-dev": {
2725
"phpunit/phpunit": "^4.8|^5.6",

composer.lock

Lines changed: 616 additions & 136 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/AttributeBuilder.php

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@
1111

1212
namespace Tmilos\ScimSchema\Builder;
1313

14-
use Tmilos\ScimSchema\Model\Attribute;
15-
use Tmilos\ScimSchema\Model\AttributeTypeValue;
16-
use Tmilos\ScimSchema\Model\MutabilityValue;
17-
use Tmilos\ScimSchema\Model\ReferenceTypeValue;
18-
use Tmilos\ScimSchema\Model\ReturnedValue;
19-
use Tmilos\ScimSchema\Model\UniquenessValue;
14+
use Tmilos\ScimSchema\Model\Schema\Attribute;
15+
use Tmilos\ScimSchema\Model\Schema\MutabilityValue;
16+
use Tmilos\ScimSchema\Model\Schema\ReturnedValue;
17+
use Tmilos\ScimSchema\Model\Schema\UniquenessValue;
2018

2119
class AttributeBuilder
2220
{
2321
/** @var string */
2422
protected $name;
2523

26-
/** @var AttributeTypeValue */
24+
/** @var string */
2725
protected $type;
2826

2927
/** @var bool */
@@ -44,26 +42,26 @@ class AttributeBuilder
4442
/** @var bool */
4543
protected $caseExact = false;
4644

47-
/** @var MutabilityValue */
45+
/** @var string */
4846
protected $mutability;
4947

50-
/** @var ReturnedValue */
48+
/** @var string */
5149
protected $returned;
5250

53-
/** @var UniquenessValue */
51+
/** @var string */
5452
protected $uniqueness;
5553

5654
/** @var string[] */
5755
protected $referenceTypes = [];
5856

5957
/**
60-
* @param string $name
61-
* @param AttributeTypeValue $type
62-
* @param string $description
58+
* @param string $name
59+
* @param string $type
60+
* @param string $description
6361
*
6462
* @return AttributeBuilder
6563
*/
66-
public static function create($name, AttributeTypeValue $type, $description = null)
64+
public static function create($name, $type, $description = null)
6765
{
6866
$result = new static();
6967
$result->name = $name;
@@ -75,9 +73,9 @@ public static function create($name, AttributeTypeValue $type, $description = nu
7573

7674
protected function __construct()
7775
{
78-
$this->mutability = MutabilityValue::READ_WRITE();
79-
$this->returned = ReturnedValue::BY_DEFAULT();
80-
$this->uniqueness = UniquenessValue::NONE();
76+
$this->mutability = MutabilityValue::READ_WRITE;
77+
$this->returned = ReturnedValue::BY_DEFAULT;
78+
$this->uniqueness = UniquenessValue::NONE;
8179
}
8280

8381
/**
@@ -138,35 +136,35 @@ public function setCaseExact($caseExact)
138136
}
139137

140138
/**
141-
* @param MutabilityValue $mutability
139+
* @param string $mutability
142140
*
143141
* @return AttributeBuilder
144142
*/
145-
public function setMutability(MutabilityValue $mutability)
143+
public function setMutability($mutability)
146144
{
147145
$this->mutability = $mutability;
148146

149147
return $this;
150148
}
151149

152150
/**
153-
* @param ReturnedValue $returned
151+
* @param string $returned
154152
*
155153
* @return AttributeBuilder
156154
*/
157-
public function setReturned(ReturnedValue $returned)
155+
public function setReturned($returned)
158156
{
159157
$this->returned = $returned;
160158

161159
return $this;
162160
}
163161

164162
/**
165-
* @param UniquenessValue $uniqueness
163+
* @param string $uniqueness
166164
*
167165
* @return AttributeBuilder
168166
*/
169-
public function setUniqueness(UniquenessValue $uniqueness)
167+
public function setUniqueness($uniqueness)
170168
{
171169
$this->uniqueness = $uniqueness;
172170

@@ -227,13 +225,13 @@ public function setReferenceTypes(array $referenceTypes)
227225
}
228226

229227
/**
230-
* @param ReferenceTypeValue $referenceType
228+
* @param string $referenceType
231229
*
232230
* @return AttributeBuilder
233231
*/
234-
public function addReferenceType(ReferenceTypeValue $referenceType)
232+
public function addReferenceType($referenceType)
235233
{
236-
$this->referenceTypes[] = $referenceType->getValue();
234+
$this->referenceTypes[] = $referenceType;
237235

238236
return $this;
239237
}

src/Builder/ResourceTypeBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function buildUser()
107107
$result->setDescription('User Account');
108108
$result->setEndpoint('/Users');
109109
$result->setSchema(Schema::USER);
110-
$result->addSchemaExtension(Schema::ENTERPRISE_USER, true);
110+
$result->addSchemaExtension(Schema::ENTERPRISE_USER, false);
111111
$result->getMeta()->setLocation($this->locationBase.'/ResourceTypes/'.$result->getId());
112112

113113
return $result;

src/Builder/SchemaBuilder.php

Lines changed: 251 additions & 251 deletions
Large diffs are not rendered by default.

src/Helper.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,27 @@
1111

1212
namespace Tmilos\ScimSchema;
1313

14+
use Tmilos\ScimSchema\Model\Schema\Attribute;
15+
1416
abstract class Helper
1517
{
18+
/**
19+
* @param string $name
20+
* @param Attribute[] $attributes
21+
*
22+
* @return Attribute|null
23+
*/
24+
public static function findAttribute($name, $attributes)
25+
{
26+
foreach ($attributes as $attribute) {
27+
if ($attribute->getName() === $name) {
28+
return $attribute;
29+
}
30+
}
31+
32+
return null;
33+
}
34+
1635
public static function dateTime2string(\DateTime $dateTime)
1736
{
1837
if ($dateTime->getTimezone()->getName() === \DateTimeZone::UTC) {

src/Model/AbstractResource.php

Lines changed: 0 additions & 146 deletions
This file was deleted.

src/Model/AttributeCollection.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/Model/DeserializableInterface.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the tmilos/scim-schema package.
5+
*
6+
* (c) Milos Tomic <[email protected]>
7+
*
8+
* This source file is subject to the MIT license that is bundled
9+
* with this source code in the file LICENSE.
10+
*/
11+
12+
namespace Tmilos\ScimSchema\Model;
13+
14+
interface DeserializableInterface
15+
{
16+
/**
17+
* @param array $data
18+
*
19+
* @return object
20+
*/
21+
public static function deserializeObject(array $data);
22+
}

0 commit comments

Comments
 (0)