Skip to content

Commit

Permalink
The String class is not suported in PHP 7.
Browse files Browse the repository at this point in the history
Refactor String Class to Str Class to prevent conflict with reserve keys in PHP 7
  • Loading branch information
oscarruesga committed Jun 18, 2016
1 parent a239144 commit 0ff5d82
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class Account extends Element {
protected $props = [
'homePage' => 'Locker\XApi\IRI',
'name' => 'Locker\XApi\String',
'name' => 'Locker\XApi\Str',
];
protected $required_props = ['homePage', 'name'];
}
2 changes: 1 addition & 1 deletion src/Agent.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Agent extends Element {
use TypedElement;

protected $props = [
'name' => 'Locker\XApi\String',
'name' => 'Locker\XApi\Str',
'mbox' => 'Locker\XApi\Mailto',
'mbox_sha1sum' => 'Locker\XApi\Sha1',
'openid' => 'Locker\XApi\IRI',
Expand Down
2 changes: 1 addition & 1 deletion src/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Attachment extends Element {
'description' => 'Locker\XApi\LanguageMap',
'contentType' => 'Locker\XApi\IMT',
'length' => 'Locker\XApi\Integer',
'sha2' => 'Locker\XApi\String',
'sha2' => 'Locker\XApi\Str',
'fileUrl' => 'Locker\XApi\IRI'
];
protected $required_props = ['usageType', 'display', 'contentType', 'length', 'sha2'];
Expand Down
4 changes: 2 additions & 2 deletions src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class Context extends Element {
'instructor' => 'Locker\XApi\Actor',
'team' => 'Locker\XApi\Group',
'contextActivities' => 'Locker\XApi\ContextActivities',
'revision' => 'Locker\XApi\String',
'platform' => 'Locker\XApi\String',
'revision' => 'Locker\XApi\Str',
'platform' => 'Locker\XApi\Str',
'language' => 'Locker\XApi\Language',
'statement' => 'Locker\XApi\StatementRef',
'extensions' => 'Locker\XApi\Extensions'
Expand Down
2 changes: 1 addition & 1 deletion src/InteractionComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class InteractionComponent extends Element {
protected $props = [
'id' => 'Locker\XApi\String',
'id' => 'Locker\XApi\Str',
'description' => 'Locker\XApi\LanguageMap'
];
}
2 changes: 1 addition & 1 deletion src/LanguageMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function validate() {
$errors = array_merge($errors, (new Language($set_prop))->validate());
$errors = array_merge($errors, array_map(function ($error) use ($set_prop) {
return $error->addTrace($set_prop);
}, (new String($this->value->{$set_prop}))->validate()));
}, (new Str($this->value->{$set_prop}))->validate()));
}
return array_merge($errors, parent::validate());
}
Expand Down
2 changes: 1 addition & 1 deletion src/ObjectDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class ObjectDefinition extends Definition {
protected $props = [
'interactionType' => 'Locker\XApi\InteractionType',
'correctResponsesPattern' => 'Locker\XApi\Strings',
'correctResponsesPattern' => 'Locker\XApi\Strs',
'choices' => 'Locker\XApi\InteractionComponents',
'scale' => 'Locker\XApi\InteractionComponents',
'source' => 'Locker\XApi\InteractionComponents',
Expand Down
2 changes: 1 addition & 1 deletion src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Result extends Element {
'score' => 'Locker\XApi\Score',
'success' => 'Locker\XApi\Boolean',
'completion' => 'Locker\XApi\Boolean',
'response' => 'Locker\XApi\String',
'response' => 'Locker\XApi\Str',
'duration' => 'Locker\XApi\Duration',
'extensions' => 'Locker\XApi\Extensions',
];
Expand Down
2 changes: 1 addition & 1 deletion src/String.php → src/Str.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php namespace Locker\XApi;

class String extends TypedAtom {
class Str extends TypedAtom {
protected static $expected_types = ['string'];
}
2 changes: 1 addition & 1 deletion src/Strings.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php namespace Locker\XApi;

class Strings extends Collection {
protected $member_type = 'Locker\XApi\String';
protected $member_type = 'Locker\XApi\Str';
}

0 comments on commit 0ff5d82

Please sign in to comment.