Completed
Push — master ( 0e16bb...b7cc2d )
by Peter
29:55 queued 26:31
created

MongoWriteStringId::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
3
/**
4
 * This software package is licensed under AGPL or Commercial license.
5
 *
6
 * @package maslosoft/mangan
7
 * @licence AGPL or Commercial
8
 * @copyright Copyright (c) Piotr Masełkowski <[email protected]>
9
 * @copyright Copyright (c) Maslosoft
10
 * @copyright Copyright (c) Others as mentioned in code
11
 * @link http://maslosoft.com/mangan/
12
 */
13
14
namespace Maslosoft\Mangan\Sanitizers;
15
16
/**
17
 * MongoStringId
18
 * This sanitizer provide mongo id as string, while saving to db as `ObjectId`
19
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
20
 */
21
class MongoWriteStringId extends MongoObjectId
22
{
23
24 14
	public function write($model, $dbValue)
25
	{
26 14
		return $this->_cast($dbValue, true);
27
	}
28
29
}
30