public function fromFile($filePath)
    {
        $pemString = file_get_contents($filePath);

        if (!$pemString) {
            throw new RuntimeException("Unable to read file at path '$filePath'.");
        }

        try {
            $certificate = $this->fromString($pemString);
        } catch (Exception $e) {
            throw new RuntimeException("File at '$filePath' does not contain a valid certificate.", 0, $e);
        }
        return $certificate;
    }
public function fromFile($filePath)
    {
        $pemString = file_get_contents($filePath);

        if (!$pemString) {
            throw new RuntimeException("Unable to read file at path '$filePath'.");
        }

        try {
            $certificate = $this->fromString($pemString);
        } catch (Exception $e) {
            throw new RuntimeException("File at '$filePath' does not contain a valid certificate.", 0, $e);
        }
        return $certificate;
    }
public function fromFile ( $ filePath ) { $ pemString = file_get_contents ( $ filePath ) ; if ( ! $ pemString ) { throw new RuntimeException ( "Unable to read file at path '$filePath'." ) ; } try { $ certificate = $ this -> fromString ( $ pemString ) ; } catch ( Exception $ e ) { throw new RuntimeException ( "File at '$filePath' does not contain a valid certificate." , 0 , $ e ) ; } return $ certificate ; }
Create a certificate from a file path.

@param string $filePath
@return X509Certificate
@throws RuntimeException
Create a certificate from a file path .