Skip to content
This repository was archived by the owner on Jun 26, 2025. It is now read-only.

Commit a74a335

Browse files
committed
Example implementation of CollectionInterface and AbstractCollection.
1 parent d306905 commit a74a335

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

tests/Mock/Foo.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace TwoDotsTwice\Collection\Mock;
4+
5+
class Foo
6+
{
7+
/**
8+
* @var int
9+
*/
10+
protected $id;
11+
12+
/**
13+
* @var string
14+
*/
15+
protected $name;
16+
17+
/**
18+
* @param $id
19+
* @param $name
20+
*/
21+
public function __construct($id, $name)
22+
{
23+
$this->id = $id;
24+
$this->name = $name;
25+
}
26+
27+
/**
28+
* @return int
29+
*/
30+
public function getId()
31+
{
32+
return $this->id;
33+
}
34+
35+
/**
36+
* @return string
37+
*/
38+
public function getName()
39+
{
40+
return $this->name;
41+
}
42+
}

tests/Mock/FooCollection.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace TwoDotsTwice\Collection\Mock;
4+
5+
use TwoDotsTwice\Collection\AbstractCollection;
6+
7+
final class FooCollection extends AbstractCollection
8+
{
9+
/**
10+
* @inheritdoc
11+
*/
12+
protected function getValidObjectType()
13+
{
14+
return Foo::class;
15+
}
16+
}

0 commit comments

Comments
 (0)