Skip to content

Commit

Permalink
Merge pull request #27 from YetiForceCompany/developer
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
mariuszkrzaczkowski committed Oct 28, 2021
2 parents 32dd9a8 + ca04b8c commit ba6173d
Show file tree
Hide file tree
Showing 139 changed files with 387 additions and 222 deletions.
162 changes: 162 additions & 0 deletions .php_cs.dist
@@ -0,0 +1,162 @@
<?php

$config = \PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setIndent("\t")
->setUsingCache(false)
->setRules([
'@PHP56Migration' => true,
'@PHPUnit60Migration:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,
'list_syntax' => ['syntax' => 'short'],
'@PSR2' => true,
'align_multiline_comment' => true,
'array_syntax' => ['syntax' => 'short'],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => false,
'binary_operator_spaces' => true,
'cast_spaces' => true,
'class_keyword_remove' => false,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'compact_nullable_typehint' => true,
'concat_space' => [
'spacing' => 'one',
],
'explicit_string_variable' => false,
'declare_equal_normalize' => true,
'dir_constant' => false,
'doctrine_annotation_braces' => true,
'doctrine_annotation_indentation' => true,
'doctrine_annotation_spaces' => true,
'function_typehint_space' => true,
'general_phpdoc_annotation_remove' => false,
'hash_to_slash_comment' => true,
'include' => true,
'linebreak_after_opening_tag' => true,
'lowercase_cast' => true,
'magic_constant_casing' => true,
'method_chaining_indentation' => true,
'method_separation' => true,
'method_argument_space' => true,
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'no_multiline_whitespace_before_semicolons' => true,
'native_function_casing' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'all'],
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_blank_lines_before_namespace' => false,
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']],
'no_extra_consecutive_blank_lines' => [
'break',
'continue',
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'throw',
'use',
'useTrait',
],
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => [
'use' => 'echo',
],
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
'no_null_property_initialization' => true,
'no_php4_constructor' => false,
'no_short_bool_cast' => true,
'no_short_echo_tag' => true,
'no_superfluous_phpdoc_tags' => false,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_final_method' => true,
'no_unused_imports' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_space' => false,
'not_operator_with_successor_space' => false,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => false,
'ordered_imports' => true,
'php_unit_construct' => [],
'php_unit_fqcn_annotation' => true,
'php_unit_strict' => true,
'phpdoc_add_missing_param_annotation' => [
'only_untyped' => false,
],
'phpdoc_align' => true,
'phpdoc_annotation_without_dot' => false,
'phpdoc_indent' => true,
'phpdoc_inline_tag' => true,
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => false,
'phpdoc_no_package' => false,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'phpdoc_var_without_name' => true,
'psr_autoloading' => false,
'return_type_declaration' => true,
'self_accessor' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
'silenced_deprecation_error' => false,
'single_blank_line_at_eof' => true,
'single_blank_line_before_namespace' => true,
'single_class_element_per_statement' => true,
'single_import_per_statement' => true,
'single_line_comment_style' => true,
'single_line_throw' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'strict_comparison' => false,
'strict_param' => false,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => false,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'property',
'method',
],
'whitespace_after_comma_in_array' => true,
])
->setFinder(PhpCsFixer\Finder::create()
->exclude('vendor')
->in(__DIR__)
);

return $config;
30 changes: 18 additions & 12 deletions LICENSE
@@ -1,15 +1,21 @@
YetiForce Public License v3
Open license based on MIT license
Copyright (c) 2017 YetiForce Sp. z o.o. (Ltd.)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The inclusion of abovementioned notices may be in a form of an active link to the license, as stated in Appendix A.

The Software used for more than 14 days must be registered via the built-in form.
If such registration is not possible, further use of the Software requires registration via email (registration@yetiforce.com), as stated in Appendix B.
The registration form is properly submitted if sent (data entry to electronic communication system) and if it contains complete and true data.
Registration is mandatory for any company (registration does not apply to employees of these companies or private individuals) that uses, configures and/or modifies the Software, regardless of whether the entity does it for itself or for other subjects.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.



THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE

SOFTWARE.
4 changes: 1 addition & 3 deletions README.MD
@@ -1,11 +1,9 @@
# YetiForcePDF
[![Latest Stable Version](https://poser.pugx.org/yetiforce/yetiforcepdf/v/stable)](https://packagist.org/packages/yetiforce/yetiforcepdf)
[![Build Status](https://travis-ci.org/YetiForceCompany/YetiForcePDF.svg?branch=developer)](https://travis-ci.org/YetiForceCompany/YetiForcePDF)
[![Analytics](https://ga-beacon.appspot.com/UA-81376231-2/welcome-page)](https://github.com/igrigorik/ga-beacon)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/YetiForceCompany/YetiForcePDF/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/YetiForceCompany/YetiForcePDF/?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b2e8645f5091496089ed203d05a05d61)](https://app.codacy.com/app/mariuszkrzaczkowski/YetiForcePDF?utm_source=github.com&utm_medium=referral&utm_content=YetiForceCompany/YetiForcePDF&utm_campaign=Badge_Grade_Settings)
[![Maintainability](https://api.codeclimate.com/v1/badges/af478ddd07cf7278841a/maintainability)](https://codeclimate.com/github/YetiForceCompany/YetiForcePDF/maintainability)
[![SymfonyInsight](https://insight.symfony.com/projects/d944b009-6a76-4957-8833-db95b010e5a5/big.png)](https://insight.symfony.com/projects/d944b009-6a76-4957-8833-db95b010e5a5)

## PDF generation library for PHP
The best library in the world to generate PDF from HTML
Expand Down Expand Up @@ -196,7 +194,7 @@ When you want to place page number (in header or footer for example) you can do
- [ ] position (absolute, relative)

### License
YetiForce Public License v3
MIT
=======
file_put_contents('test.pdf', $pdfFile);
```
3 changes: 2 additions & 1 deletion composer.json
@@ -1,6 +1,7 @@
{
"name": "yetiforce/yetiforcepdf",
"description": "Library that generate pdf files from html.",
"license": "MIT",
"type": "library",
"keywords": [
"pdf",
Expand All @@ -11,7 +12,7 @@
"authors": [
{
"name": "YetiForceCompany",
"email": "info@yetiforce.com",
"email": "devs@yetiforce.com",
"homepage": "https://yetiforce.com/"
}
],
Expand Down
8 changes: 4 additions & 4 deletions examples/ColSpan.php
Expand Up @@ -3,8 +3,8 @@
$loader = require '../vendor/autoload.php';
$files = ['ColSpan'];
foreach ($files as $file) {
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
}
6 changes: 3 additions & 3 deletions examples/CustomFonts.php
Expand Up @@ -7,19 +7,19 @@
'family' => 'Pacifico',
'weight' => '400',
'style' => 'normal',
'file' => 'd:\fonts\Pacifico\Pacifico-Regular.ttf'
'file' => 'd:\fonts\Pacifico\Pacifico-Regular.ttf',
],
[
'family' => 'Lobster Two',
'weight' => '400',
'style' => 'normal',
'file' => 'd:\fonts\Lobster_Two\LobsterTwo-Regular.ttf'
'file' => 'd:\fonts\Lobster_Two\LobsterTwo-Regular.ttf',
],
[
'family' => 'Lobster Two',
'weight' => 'bold',
'style' => 'normal',
'file' => 'd:\fonts\Lobster_Two\LobsterTwo-Bold.ttf'
'file' => 'd:\fonts\Lobster_Two\LobsterTwo-Bold.ttf',
],
]);

Expand Down
8 changes: 4 additions & 4 deletions examples/DefaultStyles.php
Expand Up @@ -3,8 +3,8 @@
$loader = require '../vendor/autoload.php';
$files = ['DefaultStyles'];
foreach ($files as $file) {
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
}
8 changes: 4 additions & 4 deletions examples/HeaderFooter.php
Expand Up @@ -3,8 +3,8 @@
$loader = require '../vendor/autoload.php';
$files = ['HeaderFooter'];
foreach ($files as $file) {
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
}
8 changes: 4 additions & 4 deletions examples/Image.php
Expand Up @@ -3,8 +3,8 @@
$loader = require '../vendor/autoload.php';
$files = ['Image'];
foreach ($files as $file) {
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
}
2 changes: 1 addition & 1 deletion examples/InvoiceTable.php
Expand Up @@ -5,5 +5,5 @@
$document->loadHtml(file_get_contents('InvoiceTable.html'));
$time = microtime(true);
$pdfFile = $document->render();
echo microtime(true)-$time;
echo microtime(true) - $time;
file_put_contents('InvoiceTable.pdf', $pdfFile);
2 changes: 1 addition & 1 deletion examples/LongTable.php
Expand Up @@ -7,6 +7,6 @@
$document->loadHtml(file_get_contents($file . '.html'));
$time = microtime(true);
$pdfFile = $document->render();
echo microtime(true) -$time;
echo microtime(true) - $time;
file_put_contents($file . '.pdf', $pdfFile);
}
2 changes: 1 addition & 1 deletion examples/LoremIpsum.php
Expand Up @@ -7,6 +7,6 @@
$document->loadHtml(file_get_contents($file . '.html'));
$time = microtime(true);
$pdfFile = $document->render();
echo microtime(true) -$time;
echo microtime(true) - $time;
file_put_contents($file . '.pdf', $pdfFile);
}
2 changes: 1 addition & 1 deletion examples/NotExported.php
Expand Up @@ -7,6 +7,6 @@
$document->loadHtml(file_get_contents($file . '.html'));
$time = microtime(true);
$pdfFile = $document->render();
echo microtime(true) -$time;
echo microtime(true) - $time;
file_put_contents($file . '.pdf', $pdfFile);
}
8 changes: 4 additions & 4 deletions examples/Pages.php
Expand Up @@ -3,8 +3,8 @@
$loader = require '../vendor/autoload.php';
$files = ['Pages'];
foreach ($files as $file) {
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
}
2 changes: 1 addition & 1 deletion examples/PagesTables.php
Expand Up @@ -7,6 +7,6 @@
$document->loadHtml(file_get_contents($file . '.html'));
$time = microtime(true);
$pdfFile = $document->render();
echo microtime(true)-$time;
echo microtime(true) - $time;
file_put_contents($file . '.pdf', $pdfFile);
}
2 changes: 1 addition & 1 deletion examples/PagesTables2.html.php
@@ -1,7 +1,7 @@
<?php

$html = '<table style="border:1px solid #000;border-collapse:collapse;"><tbody>';
for ($i = 0; $i < 100; $i++) {
for ($i = 0; $i < 100; ++$i) {
$html .= '<tr><td style="border:1px solid red;">' . $i . '</td><td style="border:1px solid green;">item</td></tr>';
}
$html .= '</tbody></table>';
3 changes: 1 addition & 2 deletions examples/PagesTables2.php
@@ -1,9 +1,8 @@
<?php

$loader = require '../vendor/autoload.php';
require('PagesTables2.html.php');
require 'PagesTables2.html.php';
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml($html);
$pdfFile = $document->render();
file_put_contents('PagesTables2.pdf', $pdfFile);

8 changes: 4 additions & 4 deletions examples/RowSpan.php
Expand Up @@ -3,8 +3,8 @@
$loader = require '../vendor/autoload.php';
$files = ['RowSpan'];
foreach ($files as $file) {
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
$document = (new YetiForcePDF\Document())->init();
$document->loadHtml(file_get_contents($file . '.html'));
$pdfFile = $document->render();
file_put_contents($file . '.pdf', $pdfFile);
}

0 comments on commit ba6173d

Please sign in to comment.