Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • Finder
  • Glob
  • SplFileInfo
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: /*
 4:  * This file is part of the Symfony package.
 5:  *
 6:  * (c) Fabien Potencier <fabien@symfony.com>
 7:  *
 8:  * For the full copyright and license information, please view the LICENSE
 9:  * file that was distributed with this source code.
10:  */
11: 
12: namespace Symfony\Component\Finder;
13: 
14: /**
15:  * Extends \SplFileInfo to support relative paths
16:  *
17:  * @author Fabien Potencier <fabien@symfony.com>
18:  */
19: class SplFileInfo extends \SplFileInfo
20: {
21:     private $relativePath;
22:     private $relativePathname;
23: 
24:     /**
25:      * Constructor
26:      *
27:      * @param string $file             The file name
28:      * @param string $relativePath     The relative path
29:      * @param string $relativePathname The relative path name
30:      */
31:     public function __construct($file, $relativePath, $relativePathname)
32:     {
33:         parent::__construct($file);
34:         $this->relativePath = $relativePath;
35:         $this->relativePathname = $relativePathname;
36:     }
37: 
38:     /**
39:      * Returns the relative path
40:      *
41:      * @return string the relative path
42:      */
43:     public function getRelativePath()
44:     {
45:         return $this->relativePath;
46:     }
47: 
48:     /**
49:      * Returns the relative path name
50:      *
51:      * @return string the relative path name
52:      */
53:     public function getRelativePathname()
54:     {
55:         return $this->relativePathname;
56:     }
57: 
58:     /**
59:      * Returns the contents of the file
60:      *
61:      * @return string the contents of the file
62:      *
63:      * @throws \RuntimeException
64:      */
65:     public function getContents()
66:     {
67:         $level = error_reporting(0);
68:         $content = file_get_contents($this->getRealpath());
69:         error_reporting($level);
70:         if (false === $content) {
71:             $error = error_get_last();
72:             throw new \RuntimeException($error['message']);
73:         }
74: 
75:         return $content;
76:     }
77: }
78: 
php-coveralls API documentation generated by ApiGen 2.8.0