@@ -20,6 +20,9 @@ class Printer
20
20
{
21
21
use Nette \SmartObject;
22
22
23
+ /** @var int */
24
+ public $ wrapLength = 120 ;
25
+
23
26
/** @var string */
24
27
protected $ indentation = "\t" ;
25
28
@@ -73,7 +76,7 @@ public function printClosure(Closure $closure, PhpNamespace $namespace = null):
73
76
foreach ($ closure ->getUses () as $ param ) {
74
77
$ uses [] = ($ param ->isReference () ? '& ' : '' ) . '$ ' . $ param ->getName ();
75
78
}
76
- $ useStr = strlen ($ tmp = implode (', ' , $ uses )) > $ this ->dumper -> wrapLength && count ($ uses ) > 1
79
+ $ useStr = strlen ($ tmp = implode (', ' , $ uses )) > $ this ->wrapLength && count ($ uses ) > 1
77
80
? "\n" . $ this ->indentation . implode (", \n" . $ this ->indentation , $ uses ) . "\n"
78
81
: $ tmp ;
79
82
$ body = Helpers::simplifyTaggedNames ($ closure ->getBody (), $ this ->namespace );
@@ -320,7 +323,7 @@ protected function printParameters($function, int $column = 0): string
320
323
321
324
$ line = implode (', ' , $ params );
322
325
323
- return count ($ params ) > 1 && ($ special || strlen ($ line ) + $ column > $ this ->dumper -> wrapLength )
326
+ return count ($ params ) > 1 && ($ special || strlen ($ line ) + $ column > $ this ->wrapLength )
324
327
? "( \n" . $ this ->indent (implode (", \n" , $ params )) . ($ special ? ', ' : '' ) . "\n) "
325
328
: "( $ line) " ;
326
329
}
@@ -390,6 +393,7 @@ protected function indent(string $s): string
390
393
protected function dump ($ var , int $ column = 0 ): string
391
394
{
392
395
$ this ->dumper ->indentation = $ this ->indentation ;
396
+ $ this ->dumper ->wrapLength = $ this ->wrapLength ;
393
397
$ s = $ this ->dumper ->dump ($ var , $ column );
394
398
$ s = Helpers::simplifyTaggedNames ($ s , $ this ->namespace );
395
399
return $ s ;
0 commit comments