Skip to content

Commit ee59fd1

Browse files
committed
Make syntax compatible with older PHP-versions.
1 parent f15116f commit ee59fd1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Diff for: RedBeanPHP/Util/Either.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function index( $key = 0 ) {
145145
*
146146
* @return mixed
147147
*/
148-
public function or( $value ) {
148+
public function _or( $value ) {
149149
$reference = (is_null($this->result)) ? $value : $this->result;
150150
return $reference;
151151
}

Diff for: testing/RedUNIT/Base/Either.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ public function testEitherWithBeans()
4646
)
4747
)));
4848
$book = R::load('book', $id);
49-
asrt($book->either()->title->or('nothing'),'Socratic Questions');
49+
asrt($book->either()->title->_or('nothing'),'Socratic Questions');
5050
$pageId = R::findOne('page')->id;
51-
asrt($book->either()->ownPageList->index($pageId)->id->or(0), $pageId);
52-
asrt($book->either()->ownPageList->index($pageId+1)->ownTextList->index(1)->or(0), 0);
53-
$textId = $book->either()->ownPageList->first()->ownParagraphList->last()->id->or(0);
51+
asrt($book->either()->ownPageList->index($pageId)->id->_or(0), $pageId);
52+
asrt($book->either()->ownPageList->index($pageId+1)->ownTextList->index(1)->_or(0), 0);
53+
$textId = $book->either()->ownPageList->first()->ownParagraphList->last()->id->_or(0);
5454
asrt($textId > 0, TRUE);
5555
$text = R::load('paragraph', $textId);
56-
asrt($text->either()->page->book->title->or('nothing'), 'Socratic Questions');
57-
asrt($book->either()->ownPageList->last()->id->or(-1),$pageId);
58-
asrt($book->either()->ownPageList->id->or(-1),-1);
59-
asrt($book->either()->ownPageList->first()->ownQuoteList->first()->or('?'),'?');
56+
asrt($text->either()->page->book->title->_or('nothing'), 'Socratic Questions');
57+
asrt($book->either()->ownPageList->last()->id->_or(-1),$pageId);
58+
asrt($book->either()->ownPageList->id->_or(-1),-1);
59+
asrt($book->either()->ownPageList->first()->ownQuoteList->first()->_or('?'),'?');
6060
}
6161
}

0 commit comments

Comments
 (0)