Skip to content

Commit

Permalink
PDF-Unite Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ncjoes committed Sep 3, 2019
1 parent 6e8f2bd commit 8c951b7
Show file tree
Hide file tree
Showing 27 changed files with 757 additions and 139 deletions.
4 changes: 3 additions & 1 deletion src/PopplerPhp/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public static function setBinDirectory($dir)
*/
public static function getBinDirectory()
{
return self::get(C::BIN_DIR, H::parseDirName(realpath(__DIR__.'/../../vendor/bin/poppler')));
$win = self::get(C::BIN_DIR, H::parseDirName(realpath(__DIR__.'/../../vendor/bin/poppler')));

return PHP_OS === 'WINNT' ? $win : "";
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/PopplerPhp/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

namespace NcJoes\PopplerPhp;

/**
* Class Constants
* @package NcJoes\PopplerPhp
*/
abstract class Constants
{
//Poppler Utils Binaries
Expand Down Expand Up @@ -98,8 +102,8 @@ abstract class Constants
const BIN_DIR = 'ncjoes.poppler-php.bin_dir';
const OUTPUT_DIR = 'ncjoes.poppler-php.output_dir';
const OUTPUT_NAME = 'ncjoes.poppler-php.output_name';
const DEFAULT_OUTPUT_DIR = __DIR__.'/../../tests/results';

const DEFAULT_OUTPUT_DIR = 'tests/results';

//Config Helpers
const DFT = '_d_';
Expand Down
10 changes: 8 additions & 2 deletions src/PopplerPhp/Exceptions/PopplerPhpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

namespace NcJoes\PopplerPhp\Exceptions;

class PopplerPhpException extends \Exception
use Exception;

/**
* Class PopplerPhpException
* @package NcJoes\PopplerPhp\Exceptions
*/
class PopplerPhpException extends Exception
{

}
}
16 changes: 16 additions & 0 deletions src/PopplerPhp/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,38 @@

use NcJoes\PopplerPhp\Constants as C;

/**
* Class Helpers
* @package NcJoes\PopplerPhp
*/
abstract class Helpers
{
/**
* @param $dir
* @return mixed
*/
public static function parseDirName($dir)
{
$dir = str_replace('/', C::DS, $dir);

return $dir;
}

/**
* @param $name
* @return string|string[]|null
*/
public static function parseFileName($name)
{
$name = preg_replace("/[^A-Za-z0-9-_. ]/", '', $name);

return $name;
}

/**
* @param $dir
* @return mixed
*/
public static function parseFileRealPath($dir)
{
$dir = str_replace('\\', C::DS, $dir);
Expand Down
Loading

0 comments on commit 8c951b7

Please sign in to comment.