コード例 #1
0
 /**
  * @test
  */
 public function it_can_determine_the_matching_quote_that_wraps_the_value()
 {
     $lineWithSingleQuotedValue = new Line("FOO = 'BAR'");
     $lineWithDoubleQuotedValue = new Line('FOO = "BAR"');
     $lineWithMixedQuotedValue = new Line('FOO = \'BAR"');
     // value is wrapped with double quotes
     $this->assertSame('\'', $lineWithSingleQuotedValue->quote());
     // value is wrapped with single quotes
     $this->assertSame('"', $lineWithDoubleQuotedValue->quote());
     // value is wrapped with quotes that do not match - could be part of value itself
     $this->assertSame('', $lineWithMixedQuotedValue->quote());
 }
コード例 #2
0
 /**
  * Parse the raw lines into their respective classes.
  *
  * @return static
  */
 public function parse()
 {
     return $this->map(function ($lineText) {
         return Line::parse_raw($lineText);
     });
 }