Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kduma committed Apr 17, 2019
1 parent 9851191 commit 0b4938d
Show file tree
Hide file tree
Showing 21 changed files with 826 additions and 354 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
/.idea
/example/dump.txt
123 changes: 0 additions & 123 deletions class.lpd.php

This file was deleted.

20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "kduma/lpd",
"description": "LPD Client for PHP",
"type": "library",
"authors": [
{
"name": "Krystian Duma",
"email": "[email protected]"
}
],
"require": {
"ext-sockets": "*",
"ext-mbstring": "*"
},
"autoload": {
"psr-4": {
"KDuma\\LPD\\": "src/"
}
}
}
19 changes: 19 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

140 changes: 0 additions & 140 deletions example/class.lpr.php

This file was deleted.

36 changes: 36 additions & 0 deletions example/client-example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use KDuma\LPD\Client\Configuration;
use KDuma\LPD\Client\DebugHandler\BasicDebugHandler;
use KDuma\LPD\Client\Exceptions\InvalidJobException;
use KDuma\LPD\Client\Exceptions\PrintErrorException;
use KDuma\LPD\Client\Jobs\FileJob;
use KDuma\LPD\Client\Jobs\TextJob;
use KDuma\LPD\Client\PrintService;

set_time_limit(0);
error_reporting(E_ALL);

require '../vendor/autoload.php';

$configuration = Configuration::make('127.0.0.1');
$print_service = new PrintService($configuration);

$debug_handler = new BasicDebugHandler();
$print_service->setDebugHandler($debug_handler);

$jobs = [
new TextJob("This is test!"),
new FileJob(__FILE__)
];

foreach ($jobs as $job) {
try {
$print_service->sendJob($job);
echo "Job Sent!\n";
} catch (InvalidJobException | PrintErrorException $e) {
echo sprintf("Error occured: %s\n", $e->getMessage());
}
}

echo sprintf("\n--- DEBUG LOG ---\n\n%s", $debug_handler->getLog());
10 changes: 0 additions & 10 deletions example/client.php

This file was deleted.

Loading

0 comments on commit 0b4938d

Please sign in to comment.