Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
b8208211
Commit
b8208211
authored
Oct 17, 2009
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[2.0] Reverted wrong committed files
parent
038e6cad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
152 deletions
+11
-152
Parser.php
lib/Doctrine/Common/Annotations/Parser.php
+5
-5
AbstractPrinter.php
lib/Doctrine/ORM/Tools/Cli/Printers/AbstractPrinter.php
+6
-147
No files found.
lib/Doctrine/Common/Annotations/Parser.php
View file @
b8208211
...
...
@@ -201,7 +201,7 @@ class Parser
}
/**
* Annotation ::= "@" AnnotationName [
"(" [Values] ")"
]
* Annotation ::= "@" AnnotationName [
"(" [Values] ")"
]
* AnnotationName ::= QualifiedName | SimpleName
* QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName
* NameSpacePart ::= identifier
...
...
@@ -262,7 +262,7 @@ class Parser
}
/**
* Values ::=
Array |
Value {"," Value}*
* Values ::= Value {"," Value}*
*
* @return array
*/
...
...
@@ -320,7 +320,7 @@ class Parser
}
/**
* PlainValue ::= integer | string | float |
boolean |
Array | Annotation
* PlainValue ::= integer | string | float | Array | Annotation
*
* @return mixed
*/
...
...
@@ -410,7 +410,7 @@ class Parser
/**
* ArrayEntry ::= Value | KeyValuePair
* KeyValuePair ::= Key "="
Plain
Value
* KeyValuePair ::= Key "=" Value
* Key ::= string | integer
*
* @return array
...
...
@@ -429,7 +429,7 @@ class Parser
$key
=
$this
->
_lexer
->
token
[
'value'
];
$this
->
match
(
'='
);
return
array
(
$key
=>
$this
->
Plain
Value
());
return
array
(
$key
=>
$this
->
Value
());
}
return
array
(
$this
->
Value
());
...
...
lib/Doctrine/ORM/Tools/Cli/Printers/AbstractPrinter.php
View file @
b8208211
<?php
<?php
/*
* $Id$
*
...
...
@@ -20,7 +20,7 @@
*/
namespace
Doctrine\ORM\Tools\Cli\Printers
;
error_reporting
(
E_ALL
|
E_STRICT
);
use
Doctrine\ORM\Tools\Cli\Style
;
/**
...
...
@@ -38,11 +38,6 @@ use Doctrine\ORM\Tools\Cli\Style;
*/
abstract
class
AbstractPrinter
{
/**
* Defines the tab length
*/
const
TAB_LENGTH
=
8
;
/**
* @var resource Output Stream
*/
...
...
@@ -66,7 +61,7 @@ abstract class AbstractPrinter
public
function
__construct
(
$stream
=
STDOUT
)
{
$this
->
_stream
=
$stream
;
$this
->
setMaxColumnSize
(
0
)
;
$this
->
_maxColumnSize
=
80
;
$this
->
_initStyles
();
}
...
...
@@ -79,14 +74,10 @@ abstract class AbstractPrinter
{
// Defines base styles
$this
->
addStyles
(
array
(
'HEADER'
=>
new
Style
(),
'ERROR'
=>
new
Style
(),
'WARNING'
=>
new
Style
(),
'KEYWORD'
=>
new
Style
(),
'REQ_ARG'
=>
new
Style
(),
'OPT_ARG'
=>
new
Style
(),
'INFO'
=>
new
Style
(),
'COMMENT'
=>
new
Style
(),
'HEADER'
=>
new
Style
(),
'NONE'
=>
new
Style
(),
));
}
...
...
@@ -143,13 +134,11 @@ abstract class AbstractPrinter
/**
* Sets the maximum column size (defines the CLI margin).
*
* @param integer $maxColumnSize The maximum column size for a message.
* Must be higher than 25 and assigns default
* value (if invalid) to 80 columns.
* @param integer $maxColumnSize The maximum column size for a message
*/
public
function
setMaxColumnSize
(
$maxColumnSize
)
{
$this
->
_maxColumnSize
=
(
$maxColumnSize
>
25
)
?
$maxColumnSize
:
80
;
$this
->
_maxColumnSize
=
$maxColumnSize
;
}
/**
...
...
@@ -176,136 +165,6 @@ abstract class AbstractPrinter
return
$this
->
write
(
$message
.
PHP_EOL
,
$style
);
}
public
function
writeTaskDocumentation
(
$taskName
,
$arguments
=
array
(),
$description
,
$options
=
array
())
{
// Writting task name
$this
->
write
(
'Task: '
,
'HEADER'
)
->
writeln
(
$taskName
,
'KEYWORD'
);
// Synopsis
$this
->
writeln
(
'Synopsis:'
,
'HEADER'
);
$this
->
writeSynopsis
(
$taskName
,
$arguments
);
// We need to split the description according to maximum column size
$this
->
writeln
(
'Description:'
,
'HEADER'
);
$this
->
writeDescription
(
$description
);
// Find largest length option name (it is mandatory for tab spacing)
$lengths
=
array_map
(
create_function
(
'$v'
,
'return strlen($v["name"]);'
),
$options
);
sort
(
$lengths
,
SORT_NUMERIC
);
$highestLength
=
end
(
$lengths
);
$maxTabs
=
ceil
(
$highestLength
/
self
::
TAB_LENGTH
);
// Options (required + optional arguments)
$this
->
writeln
(
'Options:'
,
'HEADER'
);
for
(
$i
=
0
,
$len
=
count
(
$options
);
$i
<
$len
;
$i
++
)
{
$this
->
writeOption
(
$options
[
$i
],
$maxTabs
,
$highestLength
);
if
(
$i
!=
$len
-
1
)
{
$this
->
write
(
PHP_EOL
);
}
}
}
public
function
writeSynopsis
(
$taskName
,
$arguments
=
array
())
{
// Required arguments
$requiredArguments
=
''
;
if
(
isset
(
$arguments
[
'required'
]))
{
$requiredArguments
=
' '
.
((
is_array
(
$arguments
[
'required'
]))
?
implode
(
' '
,
$arguments
[
'required'
])
:
$arguments
[
'required'
]);
}
// Optional arguments
$optionalArguments
=
''
;
if
(
isset
(
$arguments
[
'optional'
]))
{
$optionalArguments
=
' '
.
((
is_array
(
$arguments
[
'optional'
]))
?
implode
(
' '
,
$arguments
[
'optional'
])
:
$arguments
[
'optional'
]);
}
$this
->
write
(
$taskName
,
'KEYWORD'
);
if
((
$l
=
strlen
(
$taskName
.
$requiredArguments
))
>
$this
->
_maxColumnSize
)
{
$this
->
write
(
PHP_EOL
);
}
$this
->
write
(
' '
.
$requiredArguments
,
'REQ_ARG'
);
if
((
$l
+
strlen
(
$optionalArguments
))
>
$this
->
_maxColumnSize
)
{
$this
->
write
(
PHP_EOL
);
}
$this
->
write
(
' '
.
$optionalArguments
,
'OPT_ARG'
);
$this
->
write
(
PHP_EOL
);
}
protected
function
writeDescription
(
$description
)
{
$descriptionLength
=
strlen
(
$description
);
$startPos
=
0
;
$maxSize
=
$endPos
=
$this
->
_maxColumnSize
;
// Description
while
(
$startPos
<
$descriptionLength
)
{
$descriptionPart
=
trim
(
substr
(
$description
,
$startPos
,
$endPos
+
1
));
$endPos
=
((
$l
=
strlen
(
$descriptionPart
))
>
$maxSize
)
?
strrpos
(
$descriptionPart
,
' '
)
:
$l
;
$endPos
=
(
$endPos
===
false
)
?
strlen
(
$description
)
:
$endPos
+
1
;
// Write description line
$this
->
writeln
(
trim
(
substr
(
$description
,
$startPos
,
$endPos
)));
$startPos
+=
$endPos
;
$endPos
=
$maxSize
;
}
}
protected
function
writeOption
(
$option
,
$maxTabs
,
$highestLength
)
{
// Option name
$this
->
write
(
$option
[
'name'
],
(
isset
(
$option
[
'required'
])
&&
$option
[
'required'
])
?
'REQ_ARG'
:
'OPT_ARG'
);
// Tab spacing
$optionLength
=
strlen
(
$option
[
'name'
]);
$tabs
=
floor
(
$optionLength
/
self
::
TAB_LENGTH
);
$decrementer
=
0
;
//echo '[' .$tabs. ']';
if
((
$optionLength
%
self
::
TAB_LENGTH
!=
0
))
{
$decrementer
=
1
;
//$tabs--;
}
$this
->
write
(
str_repeat
(
" "
,
(
$maxTabs
-
$tabs
)
*
self
::
TAB_LENGTH
));
// Description
$descriptionLength
=
strlen
(
$option
[
'description'
]);
$startPos
=
0
;
$maxSize
=
$endPos
=
$this
->
_maxColumnSize
-
(
$maxTabs
*
self
::
TAB_LENGTH
);
while
(
$startPos
<
$descriptionLength
)
{
$descriptionPart
=
trim
(
substr
(
$option
[
'description'
],
$startPos
,
$endPos
+
1
));
$endPos
=
((
$l
=
strlen
(
$descriptionPart
))
>=
$maxSize
)
?
strrpos
(
$descriptionPart
,
' '
)
:
$l
;
$endPos
=
(
$endPos
===
false
)
?
strlen
(
$option
[
'description'
])
:
$endPos
+
1
;
$descriptionLine
=
((
$startPos
!=
0
)
?
str_repeat
(
" "
,
$maxTabs
*
self
::
TAB_LENGTH
)
:
''
)
.
trim
(
substr
(
$option
[
'description'
],
$startPos
,
$endPos
));
$this
->
writeln
(
$descriptionLine
);
$startPos
+=
$endPos
;
$endPos
=
$maxSize
;
}
}
/**
* Formats the given message with the defined style.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment