[svn-components] 7382 - /experimental/MvcTools/design/design.txt

2008-02-15 Thread James Pic
Author: jpic
Date: Fri Feb 15 12:03:10 2008
New Revision: 7382

Log:
Added question about router-manager.

Modified:
experimental/MvcTools/design/design.txt

Modified: experimental/MvcTools/design/design.txt
==
--- experimental/MvcTools/design/design.txt [iso-8859-1] (original)
+++ experimental/MvcTools/design/design.txt [iso-8859-1] Fri Feb 15 12:03:10 
2008
@@ -196,11 +196,19 @@
 
 $router-run();
 
+Should the router be selected by a router manager ?
+---
+
+The router could be selected by a router-manager.
+In that case, some routing mechanism should be in the router manager.
+Router-manager shouldn't be implemented, routers should be factorized instead.
+
 Should the MVC implementation take care of actions/sub-controllers ?
 
 
 Controllers have a method looking like : run( ezcMvcInput $input )
 It's up to the controller to figure it's action using $input.
+
 
 ..
Local Variables:


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components


[svn-components] 7383 [2/2] - in /trunk/Feed: ./ design/ docs/ src/ src/exceptions/ src/interfaces/ src/modules/ src/nodes/ src/processors/ tests/ tests/atom/regression/generate/modules/dc/ tests/atom

2008-02-15 Thread Alexandru Stanoi
Added: 
trunk/Feed/tests/rss2/regression/generate/modules/dc/dc_all_lang_multiple.in
==
--- 
trunk/Feed/tests/rss2/regression/generate/modules/dc/dc_all_lang_multiple.in 
(added)
+++ 
trunk/Feed/tests/rss2/regression/generate/modules/dc/dc_all_lang_multiple.in 
[iso-8859-1] Fri Feb 15 13:12:59 2008
@@ -1,0 +1,69 @@
+?php
+return array( 'title' = 'Feed title',
+  'link'  = array( 'Feed link' ),
+  'description' = 'Feed description',
+  'item' = array( array( 'title' = 'Item title',
+  'link' = 'Item link',
+  'description' = 'Item description',
+  'DublinCore' = array( array( 
'contributor' = array( array( '#' = 'DC contributor 1',
+   
'language' = 'a' ),
+   
 array( '#' = 'DC contributor 2',
+   
'language' = 'b' ) ),
+'coverage' 
   = array( array( '#' = 'DC coverage 1',
+   
'language' = 'c' ),
+   
 array( '#' = 'DC coverage 2',
+   
'language' = 'd' ) ),
+'creator'  
   = array( array( '#' = 'DC creator 1',
+   
'language' = 'e' ),
+   
 array( '#' = 'DC creator 2',
+   
'language' = 'f' ) ),
+'date' 
   = array( array( '#' = '1202996091',
+   
'language' = 'g' ),
+   
 array( '#' = 0,
+   
'language' = 'h' ) ),
+
'description' = array( array( '#' = 'DC description 1',
+   
'language' = 'i' ),
+   
 array( '#' = 'DC description 2',
+   
'language' = 'j' ) ),
+'format'   
   = array( array( '#' = 'DC format 1',
+   
'language' = 'k' ),
+   
 array( '#' = 'DC format 2',
+   
'language' = 'l' ) ),
+
'identifier'  = array( array( '#' = 'DC identifier 1',
+   
'language' = 'm' ),
+   
 array( '#' = 'DC identifier 2',
+   
'language' = 'n' ) ),
+'language' 
   = array( array( '#' = 'DC language 1',
+   
'language' = 'o' ),
+   
 array( '#' = 'DC language 2',
+   
'language' = 'p' ) ),
+
'publisher'   = array( array( '#' = 'DC publisher 1',
+   
'language' = 'q' ),
+   
 

[svn-components] 7384 - in /trunk/Debug: design/ src/ src/exceptions/ src/interfaces/ src/stacktrace/ tests/

2008-02-15 Thread Tobias Schlitt
Author: ts
Date: Fri Feb 15 14:05:08 2008
New Revision: 7384

Log:
- Added ezcDebugStacktraceIterator interface and ezcDebugPhpStacktraceIterator.

Added:
trunk/Debug/src/exceptions/
trunk/Debug/src/exceptions/exception.php   (with props)
trunk/Debug/src/interfaces/stacktrace_iterator.php   (with props)
trunk/Debug/src/stacktrace/
trunk/Debug/src/stacktrace/php_iterator.php   (with props)
trunk/Debug/tests/php_stacktrace_iterator_test.php   (with props)
Modified:
trunk/Debug/design/class_diagram.png
trunk/Debug/src/debug.php
trunk/Debug/src/debug_autoload.php
trunk/Debug/tests/suite.php

Modified: trunk/Debug/design/class_diagram.png
==
Binary files - no diff available.

Modified: trunk/Debug/src/debug.php
==
--- trunk/Debug/src/debug.php [iso-8859-1] (original)
+++ trunk/Debug/src/debug.php [iso-8859-1] Fri Feb 15 14:05:08 2008
@@ -316,11 +316,32 @@
  * @param array(string=string) $extraInfo
  * @return void
  */
-public function log( $message, $verbosity, array $extraInfo = array() )
+public function log( $message, $verbosity, array $extraInfo = array(), 
$stackTrace = false )
 {
 // Add the verbosity
 $extraInfo = array_merge( array( verbosity = $verbosity ), 
$extraInfo );
+if ( $this-options-stackTrace === true || $stackTrace === true )
+{
+$extraInfo['stackTrace'] = $this-getStackTrace();
+}
 $this-log-log( $message, ezcLog::DEBUG, $extraInfo );
+}
+
+private function getStackTrace()
+{
+$stackTrace = array();
+if ( extension_loaded( 'xdebug' ) )
+{
+return new ezcDebugXdebugStacktraceIterator(
+xdebug_get_function_stack()
+);
+}
+else
+{
+return new ezcDebugPhpStacktraceIterator(
+debug_backtrace()
+);
+}
 }
 
 /**

Modified: trunk/Debug/src/debug_autoload.php
==
--- trunk/Debug/src/debug_autoload.php [iso-8859-1] (original)
+++ trunk/Debug/src/debug_autoload.php [iso-8859-1] Fri Feb 15 14:05:08 2008
@@ -10,15 +10,18 @@
  */
 
 return array(
-'ezcDebugOutputFormatter'   = 'Debug/interfaces/formatter.php',
-'ezcDebug'  = 'Debug/debug.php',
-'ezcDebugHtmlFormatter' = 'Debug/formatters/html_formatter.php',
-'ezcDebugMemoryWriter'  = 'Debug/writers/memory_writer.php',
-'ezcDebugMessage'   = 'Debug/debug_message.php',
-'ezcDebugOptions'   = 'Debug/options.php',
-'ezcDebugStructure' = 'Debug/structs/debug_structure.php',
-'ezcDebugSwitchTimerStruct' = 'Debug/structs/switch_timer.php',
-'ezcDebugTimer' = 'Debug/debug_timer.php',
-'ezcDebugTimerStruct'   = 'Debug/structs/timer.php',
+'ezcDebugException' = 'Debug/exceptions/exception.php',
+'ezcDebugOutputFormatter'   = 'Debug/interfaces/formatter.php',
+'ezcDebug'  = 'Debug/debug.php',
+'ezcDebugHtmlFormatter' = 'Debug/formatters/html_formatter.php',
+'ezcDebugMemoryWriter'  = 'Debug/writers/memory_writer.php',
+'ezcDebugMessage'   = 'Debug/debug_message.php',
+'ezcDebugOptions'   = 'Debug/options.php',
+'ezcDebugPhpStacktraceIterator' = 'Debug/stacktrace/php_iterator.php',
+'ezcDebugStacktraceIterator'= 
'Debug/interfaces/stacktrace_iterator.php',
+'ezcDebugStructure' = 'Debug/structs/debug_structure.php',
+'ezcDebugSwitchTimerStruct' = 'Debug/structs/switch_timer.php',
+'ezcDebugTimer' = 'Debug/debug_timer.php',
+'ezcDebugTimerStruct'   = 'Debug/structs/timer.php',
 );
 ?

Added: trunk/Debug/src/exceptions/exception.php
==
--- trunk/Debug/src/exceptions/exception.php (added)
+++ trunk/Debug/src/exceptions/exception.php [iso-8859-1] Fri Feb 15 14:05:08 
2008
@@ -1,0 +1,26 @@
+?php
+/**
+ * File containing the ezcDebugException class.
+ *
+ * @package Debug
+ * @version //autogentag//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * General exception class for the Debug component.
+ *
+ * This exception is thrown whenever something goes wrong in the Debug
+ * component internally.
+ * 
+ * @package Debug
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDebugException extends ezcBaseException
+{
+}
+
+?

Propchange: trunk/Debug/src/exceptions/exception.php

[svn-components] 7385 - in /trunk/Feed/tests/atom/regression/parse/entry/title: type_html_cdata.in type_html_cdata.out

2008-02-15 Thread Alexandru Stanoi
Author: as
Date: Fri Feb 15 14:21:35 2008
New Revision: 7385

Log:
- Added some CDATA tests for the ATOM feed parser.

Added:
trunk/Feed/tests/atom/regression/parse/entry/title/type_html_cdata.in
trunk/Feed/tests/atom/regression/parse/entry/title/type_html_cdata.out

Added: trunk/Feed/tests/atom/regression/parse/entry/title/type_html_cdata.in
==
--- trunk/Feed/tests/atom/regression/parse/entry/title/type_html_cdata.in 
(added)
+++ trunk/Feed/tests/atom/regression/parse/entry/title/type_html_cdata.in 
[iso-8859-1] Fri Feb 15 14:21:35 2008
@@ -1,0 +1,11 @@
+?xml version=1.0 encoding=utf-8?
+feed xmlns=http://www.w3.org/2005/Atom;
+  idFeed id/id
+  title type=textFeed title/title
+  updatedFeed updated/updated
+  entry
+idEntry id/id
+title type=html![CDATA[bEntry title/b]]/title
+updated2007-11-14T16:23:40+01:00/updated
+  /entry
+/feed

Added: trunk/Feed/tests/atom/regression/parse/entry/title/type_html_cdata.out
==
--- trunk/Feed/tests/atom/regression/parse/entry/title/type_html_cdata.out 
(added)
+++ trunk/Feed/tests/atom/regression/parse/entry/title/type_html_cdata.out 
[iso-8859-1] Fri Feb 15 14:21:35 2008
@@ -1,0 +1,16 @@
+?php
+$feed = new ezcFeed( 'atom' );
+
+$feed-id = 'Feed id';
+$feed-title = 'Feed title';
+$feed-title-type = 'text';
+$feed-updated = 'Feed updated';
+
+$entry = $feed-add( 'item' );
+$entry-id = 'Entry id';
+$entry-title = 'bEntry title/b';
+$entry-title-type = 'html';
+$entry-updated = 1195053820;
+
+return $feed;
+?


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components


[svn-components] 7386 - /trunk/Feed/tests/feed_test.php

2008-02-15 Thread Alexandru Stanoi
Author: as
Date: Fri Feb 15 14:40:46 2008
New Revision: 7386

Log:
- Added a test for parsing modules which are not supported (they are ignored).

Modified:
trunk/Feed/tests/feed_test.php

Modified: trunk/Feed/tests/feed_test.php
==
--- trunk/Feed/tests/feed_test.php [iso-8859-1] (original)
+++ trunk/Feed/tests/feed_test.php [iso-8859-1] Fri Feb 15 14:40:46 2008
@@ -160,6 +160,14 @@
 }
 }
 
+public function testParseModuleNotRecognized()
+{
+$feed = ezcFeed::parseContent( '?xml version=1.0 
encoding=utf-8?feed 
xmlns=http://www.w3.org/2005/Atom;unsupported_module:elementContent/unsupported_module:element/feed'
 );
+$this-assertEquals( 'ezcFeed', get_class( $feed ) );
+$this-assertEquals( 'atom', $feed-getFeedType() );
+$this-assertEquals( 'application/atom+xml', $feed-getContentType() );
+}
+
 public function testParseAtom1()
 {
 $dot = DIRECTORY_SEPARATOR;


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components


[svn-components] 7387 - in /experimental/Document: design/ src/ src/document/rst/ src/document/rst/nodes/ src/exceptions/ tests/files/rst/parser/

2008-02-15 Thread Kore Nordmann
Author: kn
Date: Fri Feb 15 16:34:12 2008
New Revision: 7387

Log:
- Parse document titles and create section structure
  # Exceptions and nodes still need to be redefined slightly to throw more
  # verbose error messages.

Added:
experimental/Document/src/document/rst/nodes/section.php   (with props)
experimental/Document/src/document/rst/nodes/text_line.php   (with props)
experimental/Document/src/document/rst/nodes/title.php   (with props)
experimental/Document/src/exceptions/rst_parser.php   (with props)
experimental/Document/tests/files/rst/parser/titles.rst
Modified:
experimental/Document/design/class_diagram.png
experimental/Document/src/document/rst/node.php
experimental/Document/src/document/rst/nodes/document.php
experimental/Document/src/document/rst/parser.php
experimental/Document/src/document_autoload.php
experimental/Document/tests/files/rst/parser/titles.txt

Modified: experimental/Document/design/class_diagram.png
==
Binary files - no diff available.

Modified: experimental/Document/src/document/rst/node.php
==
--- experimental/Document/src/document/rst/node.php [iso-8859-1] (original)
+++ experimental/Document/src/document/rst/node.php [iso-8859-1] Fri Feb 15 
16:34:12 2008
@@ -16,13 +16,18 @@
  * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
  * @license http://ez.no/licenses/new_bsd New BSD License
  */
-class ezcDocumentRstNode extends ezcBaseStruct // implements RecursiveIterator
+abstract class ezcDocumentRstNode extends ezcBaseStruct // implements 
RecursiveIterator
 {
 // Node types
-const DOCUMENT  = 0;
-const SECTION   = 1;
-const TITLE = 2;
-const PARAGRAPH = 3;
+const DOCUMENT= 0;
+const SECTION = 1;
+const TITLE   = 2;
+const PARAGRAPH   = 3;
+const TEXT_LINE   = 4;
+   
+const TABLE   = 10;
+   
+const BULLET_LIST = 20;
 // ...
 
 /**
@@ -61,7 +66,7 @@
  */
 public static function __set_state( $properties )
 {
-return new static(
+return new ezcDocumentRstNode(
 $properties['type'],
 $properties['nodes']
 );

Modified: experimental/Document/src/document/rst/nodes/document.php
==
--- experimental/Document/src/document/rst/nodes/document.php [iso-8859-1] 
(original)
+++ experimental/Document/src/document/rst/nodes/document.php [iso-8859-1] Fri 
Feb 15 16:34:12 2008
@@ -18,6 +18,13 @@
  */
 class ezcDocumentRstDocumentNode extends ezcDocumentRstNode
 {
+/**
+ * Neting depth of document is always 0
+ * 
+ * @var int
+ */
+public $depth = 0;
+
 /**
  * Construct RST document node
  * 
@@ -40,9 +47,11 @@
  */
 public static function __set_state( $properties )
 {
-return new ezcDocumentRstDocumentNode(
+$node = new ezcDocumentRstDocumentNode(
 $properties['nodes']
 );
+
+return $node;
 }
 }
 

Added: experimental/Document/src/document/rst/nodes/section.php
==
--- experimental/Document/src/document/rst/nodes/section.php (added)
+++ experimental/Document/src/document/rst/nodes/section.php [iso-8859-1] Fri 
Feb 15 16:34:12 2008
@@ -1,0 +1,71 @@
+?php
+/**
+ * File containing the ezcDocumentRstSectionNode struct
+ *
+ * @package Section
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * The document AST node
+ * 
+ * @package Section
+ * @version //autogen//
+ * @copyright Copyright (C) 2005-2008 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcDocumentRstSectionNode extends ezcDocumentRstNode
+{
+/**
+ * Section title
+ * 
+ * @var string
+ */
+public $title;
+
+/**
+ * Depth of section nesting
+ * 
+ * @var int
+ */
+public $depth;
+
+/**
+ * Construct RST document node
+ * 
+ * @param array $nodes 
+ * @return void
+ */
+public function __construct( ezcDocumentRstTextLineNode $title, $depth = 0 
)
+{
+// Perhaps check, that only node of type section and metadata are
+// added.
+parent::__construct( self::SECTION, array() );
+
+$this-title = $title;
+$this-depth = $depth;
+}
+
+/**
+ * Set state after var_export
+ * 
+ * @param array $properties 
+ * @return void
+ * @ignore
+ */
+public static function __set_state( $properties )
+{
+$node = new ezcDocumentRstSectionNode(
+

[svn-components] 7388 - /experimental/Search/design/design.txt

2008-02-15 Thread Derick Rethans
Author: dr
Date: Fri Feb 15 16:43:41 2008
New Revision: 7388

Log:
- Update with comments, extend a bit.

Modified:
experimental/Search/design/design.txt

Modified: experimental/Search/design/design.txt
==
--- experimental/Search/design/design.txt [iso-8859-1] (original)
+++ experimental/Search/design/design.txt [iso-8859-1] Fri Feb 15 16:43:41 2008
@@ -38,6 +38,9 @@
 class ezcSearchFindQuery (or one of it's children). This query object is 
created by
 calling the createFindQuery() method on this class. Besides createFindQuery(),
 a method to create a query for deleting indexed documents will be provided too.
+The classes representing documents need to implement an interface though that
+specifies __get_state() and __set_state() - something we forgot for
+PersistentObject.
 
 
 ezcSearchSessionInstance
@@ -59,21 +62,21 @@
 ezcSearchDefinitionManager and used by the backends to both index and find
 documents from the search backends. For each document field it stores a
 ezcSearchObjectProperty. It also defines a field with which a document
-can be uniquely identified. In future versions it could also group fields for
-easier searching of multiple fields etc.
-
-ezcSearchDocument
--
-
-And object that can be indexed with the search index. It is also returned as
-part of the ezcSearchResult.
+can be uniquely identified, as well as a default search field. In future
+versions it could also group fields for easier searching of multiple fields
+etc.
 
 ezcSearchHandler
 
 
 The base class that all search backends implement. The handlers now how to
 communicate to the backends, generate correct search query strings, and how to
-present results. Handlers can also accept search-backend specific options.
+present results. Handlers can also accept search-backend specific options. For
+the first version only ezcSearchSolrHandler is planned, while later versions
+might also have backends for Google, Yahoo! etc. A backend does not have to
+implement the index(), createDeleteQuery() and delete() methods, as they are
+not available for every handler.
+
 
 ezcSearchSolrHandler
 
@@ -86,8 +89,8 @@
 --
 
 Implements a fluent language to query the search index. The methods are all
-quite the same as ezcDbQuery. It is inherited by ezcSearchFindQuery and
-ezcSearchDeleteQuery for respectably searching in, or deleting from the search
+quite the same as ezcDbQuery. This class is inherited by ezcSearchFindQuery and
+ezcSearchDeleteQuery for searching in, or deleting from the search
 index.
 
 
@@ -101,9 +104,73 @@
 ezcSearchResult
 Provides meta data about the search (time, number of results, etc.) as well
 as an array of the found results. Depending on the database backend, the
-array of found documents can be of different classes, but they all inherit
-the ezcSearchDocument class.
+array of found documents can be of different classes, as the document types
+could be different.
 
+Example Usage
+=
+
+::
+
+?php
+$backend = new ezcSearchSolrHandler( 'localhost', 6983 );
+$session = new ezcSearchSession(
+   $backend,
+   new ezcSearchDefinitionManager( 'path/to/definitions' ) 
+   );
+
+// indexing a document
+$session-index( $document );
+
+// finding documents where name = Derick
+$q = $session-createFindQuery();
+$q-find( $q-eq( 'name', Derick ) );
+$ret = $session-find( $q );
+
+// finding documents where any field contains Derick, from row 10 and 7
+// rows long
+$q = $session-createFindQuery();
+$q-find( $q-eq( '*', Derick ) );
+$ret = $session-find( $q )-limit( 7, 10 );
+
+// finding documents where text contains Derick and Tiger, only
+// having name as returned field, and order by published date.
+$q = $session-createFindQuery();
+$q-select( 'name' )
+  -find( $q-and(
+  $q-eq( 'text', Derick ),
+  $q-eq( 'text', 'Tiger' )
+)
+)
+  -orderBy( 'published' );
+$ret = $session-find( $q );
+
+// finding documents where text contains Derick or Tiger
+$q = $session-createFindQuery();
+$q-find( $q-in( 'text', array( 'Derick', 'Tiger' ) ) );
+$ret = $session-find( $q );
+
+// finding documents containing 'Ramius' published between 2007-01-01 and
+// 2007-12-31
+$q = $session-createFindQuery();
+$q-find( $q-and(
+  $q-eq( 'text', 'Ramius' ),
+  $q-between( 'published',
+  new DateTime( '2007-01-01' ), // DateTime object
+  strtotime( 2007-12-31 ) // timestamp
+  ) 
+  )
+);
+$ret = $session-find( $q );
+
+// finding documents containing 'plane' and putting facets on the
+// categories, limiting result set to 8 and 

[svn-components] 7389 - /trunk/Workflow/src/options/execution_plugin_visualizer.php

2008-02-15 Thread Sebastian Bergmann
Author: sb
Date: Fri Feb 15 18:46:07 2008
New Revision: 7389

Log:
- Be more specific.

Modified:
trunk/Workflow/src/options/execution_plugin_visualizer.php

Modified: trunk/Workflow/src/options/execution_plugin_visualizer.php
==
--- trunk/Workflow/src/options/execution_plugin_visualizer.php [iso-8859-1] 
(original)
+++ trunk/Workflow/src/options/execution_plugin_visualizer.php [iso-8859-1] Fri 
Feb 15 18:46:07 2008
@@ -61,7 +61,7 @@
 
 if ( !is_dir( $propertyValue ) )
 {
-throw new ezcBaseFileNotFoundException( $propertyValue );
+throw new ezcBaseFileNotFoundException( $propertyValue, 
'directory' );
 }
 
 if ( !is_writable( $propertyValue ) )


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components


Re: [svn-components] 7388 - /experimental/Search/design/design.txt

2008-02-15 Thread Tobias Schlitt
Hi!

On 02/15/2008 04:43 PM Derick Rethans wrote:

snip /

 +The classes representing documents need to implement an interface though that
 +specifies __get_state() and __set_state() - something we forgot for
 +PersistentObject.

These methods are named getState() and setState() in PersistentObject. 
And the interface defining those actually exists in PersistentObject now 
(ezcPersistentObject). We should stick to these method names, I think.

snip /

  ezcSearchHandler
  
  
  The base class that all search backends implement. The handlers now how to
  communicate to the backends, generate correct search query strings, and how 
 to
 -present results. Handlers can also accept search-backend specific options.
 +present results. Handlers can also accept search-backend specific options. 
 For
 +the first version only ezcSearchSolrHandler is planned, while later versions
 +might also have backends for Google, Yahoo! etc. A backend does not have to
 +implement the index(), createDeleteQuery() and delete() methods, as they are
 +not available for every handler.

Could you name and describe the interfaces defining these methods here? 
I'd suggest ezcSearchIndexHandler and ezcSearchDeleteHandler.

Regards,
Toby
-- 
Mit freundlichen Grüßen / Med vennlig hilsen / With kind regards

Tobias Schlitt (GPG: 0xC462BC14) eZ Components Developer

[EMAIL PROTECTED] | eZ Systems AS | ez.no
-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components


[svn-components] 7391 - in /trunk/Debug/tests: php_stacktrace_iterator_test.php variable_dump_tool_test.php

2008-02-15 Thread Tobias Schlitt
Author: ts
Date: Fri Feb 15 20:03:56 2008
New Revision: 7391

Log:
- Moved test file to correct name.

Added:
trunk/Debug/tests/variable_dump_tool_test.php
  - copied unchanged from r7390, 
trunk/Debug/tests/php_stacktrace_iterator_test.php
Removed:
trunk/Debug/tests/php_stacktrace_iterator_test.php

-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components


[svn-components] 7390 - in /trunk/Debug: design/ src/ src/stacktrace/ src/tools/ tests/ tests/classes/

2008-02-15 Thread Tobias Schlitt
Author: ts
Date: Fri Feb 15 20:02:28 2008
New Revision: 7390

Log:
- Outsourced variable dumping code into its own tool class
  ezcDebugVariableDumpTool.
- Adjusted test case to this change.
- Extracted test object classes from test case file.

Added:
trunk/Debug/src/tools/
trunk/Debug/src/tools/dump.php   (with props)
trunk/Debug/tests/classes/
trunk/Debug/tests/classes/debug_test_dump_extended_object.php   (with props)
trunk/Debug/tests/classes/debug_test_dump_object.php   (with props)
Modified:
trunk/Debug/design/class_diagram.png
trunk/Debug/src/debug_autoload.php
trunk/Debug/src/stacktrace/php_iterator.php
trunk/Debug/tests/php_stacktrace_iterator_test.php
trunk/Debug/tests/suite.php

Modified: trunk/Debug/design/class_diagram.png
==
Binary files - no diff available.

Modified: trunk/Debug/src/debug_autoload.php
==
--- trunk/Debug/src/debug_autoload.php [iso-8859-1] (original)
+++ trunk/Debug/src/debug_autoload.php [iso-8859-1] Fri Feb 15 20:02:28 2008
@@ -23,5 +23,6 @@
 'ezcDebugSwitchTimerStruct' = 'Debug/structs/switch_timer.php',
 'ezcDebugTimer' = 'Debug/debug_timer.php',
 'ezcDebugTimerStruct'   = 'Debug/structs/timer.php',
+'ezcDebugVariableDumpTool'  = 'Debug/tools/dump.php',
 );
 ?

Modified: trunk/Debug/src/stacktrace/php_iterator.php
==
--- trunk/Debug/src/stacktrace/php_iterator.php [iso-8859-1] (original)
+++ trunk/Debug/src/stacktrace/php_iterator.php [iso-8859-1] Fri Feb 15 
20:02:28 2008
@@ -22,10 +22,6 @@
  */
 class ezcDebugPhpStacktraceIterator
 {
-const MAX_DATA = 512;
-
-const MAX_CHILDREN = 128;
-
 protected function prepare( $stackTrace )
 {
 return parent::prepare(
@@ -85,207 +81,9 @@
 $params = array();
 foreach ( $args as $arg )
 {
-$params[] = self::dumpVariable( $arg );
+$params[] = ezcDebugVariableDumpTool::dumpVariable( $arg );
 }
 return $params;
-}
-
-/**
- * Returns the string representation of an variable.
- *
- * Returns the dump of the given variable, respecting the $maxData and
- * $maxChildren paramaters when arrays or objects are dumped.
- * 
- * @param mixed $arg 
- * @param int $maxData 
- * @param int $maxChildren 
- * @return string
- */
-public static function dumpVariable( $arg, $maxData = self::MAX_DATA, 
$maxChildren = self::MAX_CHILDREN )
-{
-switch ( gettype( $arg ) )
-{
-case 'boolean':
-return self::cutString( ( $arg ? 'TRUE' : 'FALSE' ), $maxData 
);
-case 'integer':
-case 'double':
-return self::cutString( (string) $arg, $maxData );
-case 'string':
-return sprintf(
-'%s',
-self::cutString( (string) $arg, $maxData )
-);
-case 'array':
-return self::dumpArray( $arg, $maxData, $maxChildren );
-case 'object':
-return self::dumpObject( $arg, $maxData, $maxChildren );
-case 'resource':
-return self::dumpResource( $arg, $maxData );
-case 'NULL':
-return 'NULL';
-default:
-return 'unknown type';
-}
-}
-
-/**
- * Returns the string representation of an array.
- *
- * Returns the dump of the given array, respecting the $maxData and
- * $maxChildren paramaters.
- * 
- * @param array $arg 
- * @param int $maxData 
- * @param int $maxChildren 
- * @return string
- */
-private static function dumpArray( array $arg, $maxData, $maxChildren )
-{
-$max = min( count( $arg ), $maxChildren );
-
-$results = array();
-reset( $arg );
-for ( $i = 0; $i  $max; ++$i )
-{
-$results[] =
-self::dumpVariable( key( $arg ), $maxData, $maxChildren )
-. ' = '
-. self::dumpVariable( current( $arg ), $maxData, $maxChildren 
);
-next( $arg );
-}
-
-if ( $max  count( $arg ) )
-{
-$results[] = '...';
-}
-
-return sprintf(
-'array (%s)', implode( ', ', $results )
-);
-}
-
-/**
- * Returns the string representation of an object.
- *
- * Returns the dump of the given object, respecting the $maxData and
- * $maxChildren paramaters.
- * 
- * @param object $arg 
- * @param int $maxData 
- * @param int $maxChildren 
- * @return string
- */
-private static function dumpObject( $arg, $maxData, $maxChildren )
-{
-$refObj   = 

[svn-components] 7392 - /trunk/Debug/tests/suite.php

2008-02-15 Thread Tobias Schlitt
Author: ts
Date: Fri Feb 15 20:09:57 2008
New Revision: 7392

Log:
- Changed missed file name for ezcDebugVariableDumpToolTest.

Modified:
trunk/Debug/tests/suite.php

Modified: trunk/Debug/tests/suite.php
==
--- trunk/Debug/tests/suite.php [iso-8859-1] (original)
+++ trunk/Debug/tests/suite.php [iso-8859-1] Fri Feb 15 20:09:57 2008
@@ -18,7 +18,7 @@
 require_once debug_timer_test.php;
 require_once writers/memory_writer_test.php;
 require_once formatters/html_formatter_test.php;
-require_once php_stacktrace_iterator_test.php;
+require_once variable_dump_tool_test.php;
 
 /**
  * @package Debug


-- 
svn-components mailing list
svn-components@lists.ez.no
http://lists.ez.no/mailman/listinfo/svn-components