Skip to content

Commit df047a5

Browse files
committed
Add 1.4 and backport 2.0 into one
1 parent 864c4ab commit df047a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1967
-51
lines changed

composer.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
]
2727
},
2828
"autoload-dev": {
29-
"psr-4": { "PhpCsFixer\\Diff\\Tests\\": "tests/" }
29+
"psr-4": {
30+
"PhpCsFixer\\Diff\\v1_4\\Tests\\": "tests/v1_4",
31+
"PhpCsFixer\\Diff\\v2_0\\Tests\\": "tests/v2_0"
32+
}
3033
}
3134
}

src/v1_4/Chunk.php

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?php
2+
/*
3+
* This file is part of sebastian/diff.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace PhpCsFixer\Diff\v1_4;
12+
13+
class Chunk
14+
{
15+
/**
16+
* @var int
17+
*/
18+
private $start;
19+
20+
/**
21+
* @var int
22+
*/
23+
private $startRange;
24+
25+
/**
26+
* @var int
27+
*/
28+
private $end;
29+
30+
/**
31+
* @var int
32+
*/
33+
private $endRange;
34+
35+
/**
36+
* @var array
37+
*/
38+
private $lines;
39+
40+
/**
41+
* @param int $start
42+
* @param int $startRange
43+
* @param int $end
44+
* @param int $endRange
45+
* @param array $lines
46+
*/
47+
public function __construct($start = 0, $startRange = 1, $end = 0, $endRange = 1, array $lines = array())
48+
{
49+
$this->start = (int) $start;
50+
$this->startRange = (int) $startRange;
51+
$this->end = (int) $end;
52+
$this->endRange = (int) $endRange;
53+
$this->lines = $lines;
54+
}
55+
56+
/**
57+
* @return int
58+
*/
59+
public function getStart()
60+
{
61+
return $this->start;
62+
}
63+
64+
/**
65+
* @return int
66+
*/
67+
public function getStartRange()
68+
{
69+
return $this->startRange;
70+
}
71+
72+
/**
73+
* @return int
74+
*/
75+
public function getEnd()
76+
{
77+
return $this->end;
78+
}
79+
80+
/**
81+
* @return int
82+
*/
83+
public function getEndRange()
84+
{
85+
return $this->endRange;
86+
}
87+
88+
/**
89+
* @return array
90+
*/
91+
public function getLines()
92+
{
93+
return $this->lines;
94+
}
95+
96+
/**
97+
* @param array $lines
98+
*/
99+
public function setLines(array $lines)
100+
{
101+
$this->lines = $lines;
102+
}
103+
}

src/v1_4/Diff.php

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/*
3+
* This file is part of sebastian/diff.
4+
*
5+
* (c) Sebastian Bergmann <[email protected]>
6+
*
7+
* For the full copyright and license information, please view the LICENSE
8+
* file that was distributed with this source code.
9+
*/
10+
11+
namespace PhpCsFixer\Diff\v1_4;
12+
13+
class Diff
14+
{
15+
/**
16+
* @var string
17+
*/
18+
private $from;
19+
20+
/**
21+
* @var string
22+
*/
23+
private $to;
24+
25+
/**
26+
* @var Chunk[]
27+
*/
28+
private $chunks;
29+
30+
/**
31+
* @param string $from
32+
* @param string $to
33+
* @param Chunk[] $chunks
34+
*/
35+
public function __construct($from, $to, array $chunks = array())
36+
{
37+
$this->from = $from;
38+
$this->to = $to;
39+
$this->chunks = $chunks;
40+
}
41+
42+
/**
43+
* @return string
44+
*/
45+
public function getFrom()
46+
{
47+
return $this->from;
48+
}
49+
50+
/**
51+
* @return string
52+
*/
53+
public function getTo()
54+
{
55+
return $this->to;
56+
}
57+
58+
/**
59+
* @return Chunk[]
60+
*/
61+
public function getChunks()
62+
{
63+
return $this->chunks;
64+
}
65+
66+
/**
67+
* @param Chunk[] $chunks
68+
*/
69+
public function setChunks(array $chunks)
70+
{
71+
$this->chunks = $chunks;
72+
}
73+
}

0 commit comments

Comments
 (0)