Giter VIP home page Giter VIP logo

utils's Introduction

Nette Utility Classes

Downloads this Month Tests Coverage Status Latest Stable Version License

Introduction

In package nette/utils you will find a set of useful classes for everyday use:

Installation

The recommended way to install is via Composer:

composer require nette/utils
  • Nette Utils 4.0 is compatible with PHP 8.0 to 8.3
  • Nette Utils 3.2 is compatible with PHP 7.2 to 8.3
  • Nette Utils 3.1 is compatible with PHP 7.1 to 8.0
  • Nette Utils 3.0 is compatible with PHP 7.1 to 8.0
  • Nette Utils 2.5 is compatible with PHP 5.6 to 8.0

Do you like Nette Utils? Are you looking forward to the new features?

Buy me a coffee

Thank you!

utils's People

Contributors

bobey avatar crazymuffin avatar dg avatar dstrop avatar enumag avatar foxycode avatar fprochazka avatar h4kuna avatar hranicka avatar janbarasek avatar jantvrdik avatar jkuchar avatar juzna avatar kravco avatar kukulich avatar majkl578 avatar marian-r avatar matej21 avatar milo avatar mkoubik avatar mzk avatar ondrejmirtes avatar paveljurasek avatar pavelkouril avatar petrp avatar redhead avatar stekycz avatar tomaswindsor avatar vrana avatar xificurk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

utils's Issues

Image::place() Unexpected output with transparency image

Code:

$tux = Image::fromFile("http://upload.wikimedia.org/wikipedia/commons/a/a1/Tux2.png");
$firefox = Image::fromFile("http://people.mozilla.org/~faaborg/files/shiretoko/firefoxIcon/firefox-64.png");
$tux->place($firefox, '100%', '100%', 50);

should generate:
ok
but generate:
fail

Online test

Followin #91

We still encounter failure without internet access...

-- FAILED: Nette\Utils\FileSystem basic usage. | tests/Utils/FileSystem.phpt
   Exited with error code 255 (expected 0)
   Nette\IOException: Unable to copy file 'http://example.com' to '/dev/shm/BUILD/utils-f6586f827292bd35c8593df943437f2247ba5337/tests/tmp/0.95770311730773/3/x/y/file'.

   in Nette/Utils/FileSystem.php(61) 
   in tests/Utils/FileSystem.phpt(44) Nette\Utils\FileSystem::copy()
   in utils-f6586f827292bd35c8593df943437f2247ba5337/tests/bootstrap.php(39) {closure}()
   in tests/Utils/FileSystem.phpt(71) test()

Using Validators in native assert

It can be useful, when the Validators::assert will return TRUE when the check is success.

After that it can be used in native assert function like in the following example:

/**
 * Something getter
 *
 * @return ISomething
 * @throws AssertionException
 */
public function getSomething(): ISomething
{
    assert(Validators::assert($this->something, ISomething::class, 'something before get'));
    return $this->something;
}

In this way, the code can be more optimised in production by zend.assertions = -1

Json.decode().phpt fails under Debian's php5

I am constantly getting failures in Json.decode().phpt:

Note: No php.ini is used.
PHP 5.6.12-1 | php5 -d 'extension=json.so' | 8 threads

-- FAILED: Nette\Utils\Json::decode() | tests/Utils/Json.decode().phpt
   Failed: array('' => 1) should be 
       ... array("\x00" => 1)
$ php5 -r 'echo JSON_C_VERSION, PHP_EOL;'
0.11.99
$ dpkg-query -W php5-json
php5-json   1.3.7-1

Error with Normalizer

  • bug report? yes

  • version: latest, commit 6b858f6

Description

Fatal error: Method Nette\PhpGenerator\ClassType::__toString() must not throw an exception, caught Error: Class 'Normalizer' not found

File: vendor\nette\di\src\DI\PhpGenerator.php

Tested on dev-master Sandbox with PHP 7.2 RC4.

Validators: support for types int[] and string[]

How do you feel about supporting either specifically int[] and string[] (defined as list where all values are of given type)?

Or we can generally support anything[], but I don't think that's necessary.

Validators::isUrl returns FALSE when http auth is included

  • bug report? yes
  • feature request? no
  • version: 2.4.3

Description

Validators::isUrl doesn't allow http auth to be included in the provided url.

Steps To Reproduce

dump(\Nette\Utils\Validators::isUrl('http://a:b@localhost'));

Current output:
FALSE

Expected output:
TRUE

Image: error handling using exceptions

There is many error which can occurs using image function in PHP. Currently they are not handled in class Image so all possible error are always catched at application level.

Follows example of some logged errors

PHP Unknown error: imagecreatefrompng(): gd-png: fatal libpng error: incorrect data check in Unknown:0
PHP Warning: imagecreatefrompng(): '/var/php/phpUsyq5J' is not a valid PNG file in .../vendor/nette/nette/Nette/common/Image.php:171
Nette\InvalidArgumentException: Image is not valid. in .../vendor/nette/nette/Nette/common/Image.php:283
Fatal error: imagecreatefrompng(): gd-png error: setjmp returns error condition 2 in .../vendor/nette/nette/Nette/common/Image.php:171

I have an idea to have one exception for all image errors which can be catched at application level easier then handling exceptions and many types of errors. It can be something like ImageException which can be inherited by more specific exceptions.

What do you think? Does it make sense?

Validators::isUrl() should support more URL schemes

While generating my api documentation with apigen which includes the perfectly valid URL bitcoin:1335STSwu9hST4vcMRppEPgENMHD2r1REK I came across your Validators::isUrl(). It thinks that the only valid URL is a https?://…. That's quiet far away from reality. Have a look at RFC1738 and further more IANAs URI schemes.

While my primary concern is convincing Validators::isUrl() that bitcoin: is a valid URL it would also be nice to be more RFC conform. While implementing this in its complete extend might be a bit of work, you might consider pulling a dependency to an existing implementation. https://github.com/malkusch/utils/tree/valid-bitcoin-uri added a test case for the bitcoin scheme.

ArrayHash: malformed array with integer keys

When using ArrayHash created from array with integer keys, following conversion to (array) creates malformed array with string keys. Such array cannot be tested by isset() and array_key_exists(), it will results to FALSE.

This is potentially dangerous with FormContainer and integer components:

$cont = $form->addContaner('foo');
$cont->addText(1, 'One');
$cont->addText(12, 'One');

Opened PHP BUG #69799, details there.

addAttributes overrides previous values

The addAtributes method of Html object works morelike as setAttributes.

It causes me problems while adding class to form element on multiple places - typically with Bootstrap 3 renderer and my custom class.

$form = new Form;
$form->addText('name', 'Name');
    ->getControlPrototype()->addClass('myClass');

// or in non magic way
$form->addText('name', 'Name');
    ->getControlPrototype()->addAttributes(['class' => 'myClass']);

// this has the same impact, at least with correct **set** naming 
// that implies overriding of former value
$form->setAttribute('class', 'someClass'); 

The unit test:

$paragraphElement = Html::el('p');
$paragraphElement->addAttributes(['class' => 'primary']);
$this->assertSame(' class="primary"', $paragraphElement->attributes());

$paragraphElement->addAttributes(['class' => 'secondary']);

// this fails
$this->assertSame(' class="primary secondary"', $paragraphElement->attributes());

// this passes
$this->assertSame(' class="secondary"', $paragraphElement->attributes());

Is this intended behavior?

If not, shall I send PR?

Strings::webalize() returns an empty string on Alpine Linux

I think this is due to musl implementation of iconv.

bash-4.3# vendor/bin/tester tests -p php -c /etc/php/php.ini
 _____ ___  ___ _____ ___  ___
|_   _/ __)( __/_   _/ __)| _ )
  |_| \___ /___) |_| \___ |_|_\  v1.7.1

PHP 7.0.6 | php -c '/etc/php/php.ini' | 8 threads

ss...............................sssssss.Fs...............F......................F......F......................F.F......

-- FAILED: Nette\Utils\Json::encode() | tests/Utils/Json.encode().phpt
   Failed: Nette\Utils\JsonException was expected, but none was thrown

   in tests/Utils/Json.encode().phpt(39) Tester\Assert::exception()

-- FAILED: Nette\Object undeclared method. | tests/Utils/Object.undeclaredMethod.phpt
   Failed: Nette\MemberAccessException was expected but got Nette\NotSupportedException (PHP extension GD is not loaded.)

   in tests/Utils/Object.undeclaredMethod.phpt(52) Tester\Assert::exception()

-- FAILED: Nette\SmartObject undeclared method. | tests/Utils/SmartObject.undeclaredMethod.phpt
   Failed: Nette\MemberAccessException was expected but got Nette\NotSupportedException (PHP extension GD is not loaded.)

   in tests/Utils/SmartObject.undeclaredMethod.phpt(54) Tester\Assert::exception()

-- FAILED: Nette\Utils\Strings::chr() | tests/Utils/Strings.chr().phpt
   Exited with error code 255 (expected 0)
   E_NOTICE: iconv(): Wrong charset, conversion from `UTF-32BE' to `UTF-8//IGNORE' is not allowed

   in src/Utils/Strings.php(57)
   in src/Utils/Strings.php(57) iconv()
   in tests/Utils/Strings.chr().phpt(14) Nette\Utils\Strings::chr()

-- FAILED: Nette\Utils\Strings::toAscii() | tests/Utils/Strings.toAscii().phpt
   Exited with error code 255 (expected 0)
   E_NOTICE: iconv(): Wrong charset, conversion from `UTF-8' to `ASCII//TRANSLIT//IGNORE' is not allowed

   in src/Utils/Strings.php(185)
   in src/Utils/Strings.php(185) iconv()
   in tests/Utils/Strings.toAscii().phpt(14) Nette\Utils\Strings::toAscii()

-- FAILED: Nette\Utils\Strings::webalize() | tests/Utils/Strings.webalize().phpt
   Exited with error code 255 (expected 0)
   E_NOTICE: iconv(): Wrong charset, conversion from `UTF-8' to `ASCII//TRANSLIT//IGNORE' is not allowed

   in src/Utils/Strings.php(185)
   in src/Utils/Strings.php(185) iconv()
   in src/Utils/Strings.php(201) Nette\Utils\Strings::toAscii()
   in tests/Utils/Strings.webalize().phpt(14) Nette\Utils\Strings::webalize()


FAILURES! (120 tests, 6 failures, 10 skipped, 1.1 seconds)

Cannot use 'Object' as class name as it is reserved search►

  • bug report? yes
  • feature request? no
  • version: 2.4.8

Description

utils\src\Utils\Object.php - ClassName Object in PHP 7.2.1 is reserved. Please rename it.

Steps To Reproduce

Clear install nette on Windows with Apache and PHP 7.2.1. Try to run app.

Versioning bug

  • bug report

Description

Installing version by ^2.4 install 2.5.1. It's bug of Utils or composer?

Steps To Reproduce

composer.json

{
	"require": {
		"nette/utils": "^2.4"
	},
	"minimum-stability": "stable"
}

composer.lock

{
    "_readme": [
        "This file locks the dependencies of your project to a known state",
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
        "This file is @generated automatically"
    ],
    "content-hash": "085bbdba2bd9c2197de1484370a107c6",
    "packages": [
        {
            "name": "nette/utils",
            "version": "v2.5.1",
            "source": {
            ...

Notice JSON_PRESERVE_ZERO_FRACTION on php 50617

PHP_VERSION_ID = 50617

PHP Notice: Use of undefined constant JSON_PRESERVE_ZERO_FRACTION - assumed 'JSON_PRESERVE_ZERO_FRACTION' in /var/www/www/vendor/nette/utils/src/Utils/Json.php:41

Feature request: Arrays::inArray

PHP's in_array function is unsafe by default - the comparison is made without type checking, so it's prone to unexpected errors (e.g. https://news.ycombinator.com/item?id=9484757).

The implementation would be trivial (using the in-built in_array with negated $strict parameter) - I can make a PR. The question is if it's something which makes sense for Nette (it feels to me like automatic escaping based on context in Latte, so it should).

Thanks!

Add czech filter '%A'

  • bug report? no
  • feature request? yes

Description

Please add czech filter for write Czech name of Day

{$objekt->datum|date:'%A'}

Json::encode does not allow to modify its flags

The problem is that sometimes json_encode converts double into string and dometimes to number. If I want to convert it always into number I need to set flag: JSON_NUMERIC_CHECK

And there is no "pretty" way to do it.

Solution:

  • Add way to control the flags send to json_encode,
  • add JSON_NUMERIC_CHECK flag by default (is there any reason to not do it?)

Strings::toAscii returns empty string

When I run a PHP 7.0.3 CLI (Debian linux) application over SSH where I use Strings::webalize internally, I get empty strings as results in my nette-based app.

A found that problem is in Strings::toAscii implementation which is called from Strings::webalize.

Everything seems fine until iconv (glibc) call, this line.

Transliterator converts string correctly but iconv removes all of them.

When I replace iconv('UTF-8', 'WINDOWS-1250//TRANSLIT//IGNORE', $s) with iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $s), I get an output (but incorrect, with a question mark (?) instead of some characters).

The line with iconv has error supressing @. So I get no error. When I remove it, I get PHP Notice: iconv(): Wrong charset, conversion from UTF-8 to WINDOWS-1250//TRANSLIT//IGNORE is not allowed.

Testing string: Koupil pojišťovnu a chce převrátit v Česku pojišťovnictví naruby, but same behaviour with everything. Output is an empty string also when input are ASCII characters only.


Maybe, in my CLI there is something wrong with php.ini configuration. Am I first who have this problem? Is the call of iconv correct?

Thank you for help.

Nette\Utils\Html & magic

Magic functions in the class are useful, but I have problems with them.

I want use code inspection in my IDE (PhpStorm) which helps me remove bad code, I see potentionally problems with non-existent methods, properties, it's very good helper for code refactoring and its quality. But when I call eg. Html::addClass(), this method doesn't exists and IDE swears me.

So I would like implement some "real public methods" which make the work and will be used in existing magic:

  • property access
    • Html->$name = $value -> Html::setAttribute($name, $value)
    • $value = Html->$name -> Html::getAttribute($name)
    • unset(Html->$name) -> Html::removeAttribute($name)
  • magic getters/setters
    • Html::get$name() -> Html::getAttribute($name)
    • Html::set$name($value) -> Html::setAttribute($name, $value)
    • Html::add$name($value) -> Html::addAttribute($name, $value)

I can also use ArrayAccess in current state but I rather like Html::addAttribute($name, $value) than Html[$name] = [Html[$name], $value => TRUE].

It won't be BC-break and then we would call real methods and me & my IDE's code inspection will be happy.

URL validator with numbers

  • bug report? yes
  • feature request? no
  • version: 2.4.8

Description

I have in our company server with hostname "orion2".
When I use URL validator on hostname "orion2", I get AssertionException.

Before migration it was http://orion/ and it worked.

Steps To Reproduce

Validators::assert('http://orion2/network/', 'url', 'console.url');
Error:
Nette\Utils\AssertionException #bfee message protected => "The console.url expects to be url, string 'http://orion2/network/' given." (73) string private => "" code protected => 0 file protected => "C:\webserver\htdocs\network\vendor\nette\utils\src\Utils\Validators.php" (71) line protected => 90 trace private => array (7) previous private => null

Wrong returned value from createFromFormat

PHP documentation says the method should return FALSE on failure. However Nette\Utils\DateTime returns always DateTime instance.

The problem is on the line 109. I do not think there should be call of static::from. If FALSE is passed as the argument then current datetime instance is returned.

Reproduction code

Assert::false(Nette\Utils\DateTime::createFromFormat('Y-m-d', '2014-10'));

Nette\Object magic setters ignore "use" section.

namespace App\Components;
use App\Model\Data\Person;

/**
 * @method setPerson(Person)
 * @method setPerson(App\Model\Data\Person)
 */
  • First annotation throws: Argument passed to App\Components\AssignmentPanel::setPerson() must be App\Components\Person, object given..
  • Second works fine.

ArrayHash: Unset of key in foreach at on php7 skip some items

$hash = \Nette\Utils\ArrayHash::from([1 => 1, 2=> 2, 3=> 3]);
foreach($hash as $key => $value) {
    unset($hash[$key]);
}
dump($hash);

Output is:

Nette\Utils\ArrayHash #3f75
2 => 2

I'm not sure, is it bug (in php?) or it's just not supported and I'm using it wrong?

Could Filesystem::createDir return path?

  • bug report? no
  • feature request? yes
  • version: 2.4

Description

Hi, if I use any directory in component, probably i want create absolute path with any $appDir, $wwwDir, $tempDir and add sub directory.

Use case

class Foo
{
	/** @var string */
	private $tempDir;


	public function __construct($tempDir)
	{
		// now
		$this->tempDir = $tempDir . DIRECTORY_SEPARATOR . 'foo';
		\Nette\Utils\FileSystem::createDir($this->tempDir);

		// after
		$this->tempDir = \Nette\Utils\FileSystem::createDir($tempDir . DIRECTORY_SEPARATOR . 'foo');
	}

}

Is it possible? I can create PR.

ObjectMixin methods cause E_USER_DEPRECATED - BC Break

  • bug report? yes
  • feature request? no
  • version: 2.5.1

Description

I have just updated from 2.4.9 to 2.5.1 and ended up with a crashing application, because ObjectMixin now triggers error.

Updating from v2.4 to v2.5 should not break the application.

Steps To Reproduce

error_reporting(E_USER_DEPRECATED);
ObjectMixin::hasProperty(new class extends stdClass{}, 'foo');  //  E_USER_DEPRECATED

This is also true for multiple other methods within the ObjectMixin class.

Note

This is not the first issue of similar style. Please consider semantic versioning for nette package realeases.

Filesystem::write(): default file mode allows rw for everyone

  • bug report? no
  • feature request? yes
  • version: dev-master

Description

Nette Framework priority is to be secure by default. FileSystem::write() creates files that are rw for everyone. That is not secure by default. It allows everyone on the server to read and write to created file.

Imagine situation where that server is shared... (my case) Everyone who has access to server for whatever reason (e.g. to read logs) has rw access to files that has been created or modified by FileSystem::write().

Why not leave $mode to NULL and keep responsibility of setting proper permissions on system admin that configured that server? Setting chmod(0666) takes over the power of ACLs from system admin hands. He can't do anything about that then.

Exception string: Unsupported image type '$type'.

Hi,

I've just got weird message, while saving image. It seems like typo.
throw new Nette\InvalidArgumentException('Unsupported image type \'$type\'.')

So I would like to fix & pull, but suggested solution is not good enough. When user uploads image "example.jpegg" variable $type is empty and message is: Unsupported image type ''.
throw new Nette\InvalidArgumentException("Unsupported image type '$type'.");

Can somebody (with more experience) take this issue?
Thanks

utf-8 pattern

what can i do if i want to use patten validator with unicode string?

Strings::normalize() should normalize into UTF-8 NFC

  • bug report? no
  • feature request? yes
  • version: 2.4

Description

There are more ways how to save UTF-8 strings. This means that when one want to compare two strings it can be not that simple and intuitive.

$char_A_ring = "\xC3\x85"; // Å 'LATIN CAPITAL LETTER A WITH RING ABOVE' (U+00C5)
$char_combining_ring_above = "A\xCC\x8A";  // Å 'COMBINING RING ABOVE' (U+030A)

assert(\Nette\Utils\Strings::compare($char_A_ring, $char_combining_ring_above)); //error
assert(\Nette\Utils\Strings::normalize($char_A_ring) === \Nette\Utils\Strings::normalize($char_combining_ring_above)); //error

assert($char_A_ring === $char_combining_ring_above);  //error

I would expect that when I do this after Strings::normalize() this would succeed, but it does not. I would expect to normalize everything into NFC or NFD (does not matter that much). Currently there is no guarantee that two same strings will be understood as the same.

Nette\Utils\DateTime::createFromFormat() not compatible with PHP7

Declaration of Nette\Utils\DateTime::createFromFormat() should be compatible with DateTime::createFromFormat($format, $time, DateTimeZone $object = NULL)

I can prepare pull request, however I'm not sure what solution is right. I think there's maybe only one solution - remove the support for timezone as a string and add \DateTimeZone type hint. Deprecated warning will not work if the next version should have two years support.

Addition of some methods to Utils\Strings

@dg i would like to add any of following methods:

camelize($str): "column_to_property" => "columnToProperty"
uncamelize($str, '_'): "propertyToColumn" => "property_to_column"
pascalize($str): "table_to_class" => "TableToClass"
wrap($strOrArr, '|'): "some text" => "|some text|"
wrap($strOrArr, '{', '}'): "some text" => "{some text}"

I have these implemented in my library so if you approve it, i can create PR.

Rename Nette\Object (name reserved in PHP 7)

There are currently two RFCs [1] [2] in voting phase, both introducing reserved types in PHP 7. This includes "object", which, if the vote passes, will be illegal as a class/interface/trait name.

Sadly, this will be may - in 7.x - become a serious BC break with nearly impossible backward compatibility for almost all user-land applications.

[1] https://wiki.php.net/rfc/reserve_more_types_in_php_7
[2] https://wiki.php.net/rfc/reserve_even_more_types_in_php_7

Strings::match() sometimes fails on Travis

This call

Nette\Utils\Strings::match('KdybyTests\Doctrine', '#^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\\]*\z#')

somehow triggers

Fatal error: Unpacking unsupported for calls to functions that take any arguments by reference in /home/travis/build/Kdyby/Doctrine/vendor/nette/utils/src/Utils/Callback.php on line 97

which is this line.

This is how I found it https://travis-ci.org/Kdyby/Doctrine/jobs/120452083#L350 (open the after_failure dump of *.log)


Sadly, I have very little idea what exactly causes it, since it only happens on travis and I was unable to reproduce it on localhost to experiment on it.

Does anybody have any idea why this happens, or how to fix it?

Update

Seems to be relevant to running processes by PHP. I've needed to run a script, inside a Nette\Tester test case method. While that worked on localhost, it broke on Travis.

This little change fixed it - that means the Strings::pcre() is somehow dependent on environment variables.

Update

While passing the current $_ENV to the newly started process fixes it for PHP 5.6 & 7.0, on HHVM it seems to be a bigger issue.

Composer: Which dependencies should be required?

  • bug report? no
  • feature request? yes
  • follow up of #150

Description

Currently in there are dependencies on php extensions with are marked as suggested. This makes sense as not everyone what to use everything from utils package (as it is collection of independent tools).

"suggest": {
	"ext-iconv": "to use Strings::webalize() and toAscii()",
	"ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()",
	"ext-mbstring": "to use Strings::lower() etc...",
	"ext-xml": "to use Strings::length() etc. when mbstring is not available",

	"ext-json": "to use Nette\\Utils\\Json",

	"ext-gd": "to use Image"
}

I have identified 3 groups of dependencies:

  • Strings related
  • Json related
  • Image related

It happened to me for few times that I have deployed something it passed and then I realized that I forgot to enable json extension. I these extensions are required I would be stopped in installation process, before deploy.

Another thing using Strings class is complex due to 4 extensions that need to properly selected each time someone uses utils. This is so complex that in most my projects there aren't these extensions named in requires as I thought that I'm using nette\utils, they provide Strings class so they will care about dependencies. But they don't.

Goal:

  • I would like to share my confusion
  • I would like to identify "core" functionality and move it's dependencies into requires
  • Or find alternative solution to omit surprises at deploy

Html - __toString() vrati iny vysledok ako je ocakavany

$el = Html::el('span')
            ->add(Html::el('div'))
            ->add(Html::el('input'))
            ->add(Html::el('input'));
echo $el;

vysledok

<span>
    <div>
        <input>
        <input>
    </div>
</span>

toto vrati rovnaky vysledok

$el = Html::el('span')
            ->add(Html::el('div')
                ->add(Html::el('input'))
                ->add(Html::el('input')));
echo $el;

Nette\Utils\DateTime compatible problem in PHP 7

Report:

PHP Strict Standards: Declaration of Nette\Utils\DateTime::createFromFormat() should be compatible with DateTime::createFromFormat($format, $time, DateTimeZone $object = NULL) in vendor/nette/utils/src/Utils/DateTime.php on line 127

Just for keeping in mind. It is not need to fix it now,

Feature request - Image::getBytesPerPixel

It might be useful to have method to check bytes per pixel of image.
Use case: When user download and re-upload file so quality decreases althought image is already compressed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.