Browse Source

Fix docs and variable names.

Add missing docs and fix gross klassName vars.
Mark Story 11 years ago
parent
commit
e9f19585dd

+ 11 - 12
src/Core/StaticConfigTrait.php

@@ -141,22 +141,21 @@ trait StaticConfigTrait {
  * The following is an example of its usage:
  * The following is an example of its usage:
  *
  *
  * {{{
  * {{{
- *   $dsn = 'mysql://user:pass@localhost/database?';
- *   $config = ConnectionManager::parseDsn($dsn);
+ * $dsn = 'mysql://user:pass@localhost/database?';
+ * $config = ConnectionManager::parseDsn($dsn);
  *
  *
- *   $dsn = 'Cake\Log\Engine\FileLog://?types=notice,info,debug&file=debug&path=LOGS';
- * 	 $config = Log::parseDsn($dsn);
+ * $dsn = 'Cake\Log\Engine\FileLog://?types=notice,info,debug&file=debug&path=LOGS';
+ * $config = Log::parseDsn($dsn);
  *
  *
- *   $dsn = 'smtp://user:secret@localhost:25?timeout=30&client=null&tls=null';
- * 	 $config = Email::parseDsn($dsn);
+ * $dsn = 'smtp://user:secret@localhost:25?timeout=30&client=null&tls=null';
+ * $config = Email::parseDsn($dsn);
  *
  *
- *   $dsn = 'file:///?className=\My\Cache\Engine\FileEngine';
- * 	 $config = Cache::parseDsn($dsn);
+ * $dsn = 'file:///?className=\My\Cache\Engine\FileEngine';
+ * $config = Cache::parseDsn($dsn);
  *
  *
- *   $dsn = 'File://?prefix=myapp_cake_core_&serialize=true&duration=+2 minutes&path=/tmp/persistent/';
- * 	 $config = Cache::parseDsn($dsn);
- *
- * }}
+ * $dsn = 'File://?prefix=myapp_cake_core_&serialize=true&duration=+2 minutes&path=/tmp/persistent/';
+ * $config = Cache::parseDsn($dsn);
+ * }}}
  *
  *
  * For all classes, the value of `scheme` is set as the value of both the `className`
  * For all classes, the value of `scheme` is set as the value of both the `className`
  * unless they have been otherwise specified.
  * unless they have been otherwise specified.

+ 7 - 7
src/Datasource/ConnectionManager.php

@@ -73,15 +73,15 @@ class ConnectionManager {
  * The following is an example of its usage:
  * The following is an example of its usage:
  *
  *
  * {{{
  * {{{
- *   $dsn = 'mysql://user:pass@localhost/database';
- *   $config = ConnectionManager::parseDsn($dsn);
+ * $dsn = 'mysql://user:pass@localhost/database';
+ * $config = ConnectionManager::parseDsn($dsn);
  *
  *
- *   $dsn = 'Cake\Database\Driver\Mysql://localhost:3306/database?className=Cake\Database\Connection';
- *   $config = ConnectionManager::parseDsn($dsn);
+ * $dsn = 'Cake\Database\Driver\Mysql://localhost:3306/database?className=Cake\Database\Connection';
+ * $config = ConnectionManager::parseDsn($dsn);
  *
  *
- *   $dsn = 'Cake\Database\Connection://localhost:3306/database?driver=Cake\Database\Driver\Mysql';
- *   $config = ConnectionManager::parseDsn($dsn);
- * }}
+ * $dsn = 'Cake\Database\Connection://localhost:3306/database?driver=Cake\Database\Driver\Mysql';
+ * $config = ConnectionManager::parseDsn($dsn);
+ * }}}
  *
  *
  * For all classes, the value of `scheme` is set as the value of both the `className` and `driver`
  * For all classes, the value of `scheme` is set as the value of both the `className` and `driver`
  * unless they have been otherwise specified.
  * unless they have been otherwise specified.

+ 40 - 6
tests/TestCase/Core/StaticConfigTraitTest.php

@@ -26,6 +26,12 @@ class TestConnectionManagerStaticConfig {
 		parseDsn as protected _parseDsn;
 		parseDsn as protected _parseDsn;
 	}
 	}
 
 
+/**
+ * Parse a DSN
+ *
+ * @param string $config The config to parse.
+ * @return array
+ */
 	public static function parseDsn($config = null) {
 	public static function parseDsn($config = null) {
 		$config = static::_parseDsn($config);
 		$config = static::_parseDsn($config);
 
 
@@ -42,6 +48,11 @@ class TestConnectionManagerStaticConfig {
 		return $config;
 		return $config;
 	}
 	}
 
 
+/**
+ * Database driver class map.
+ *
+ * @return array
+ */
 	public static function getClassMap() {
 	public static function getClassMap() {
 		return [
 		return [
 			'mysql' => 'Cake\Database\Driver\Mysql',
 			'mysql' => 'Cake\Database\Driver\Mysql',
@@ -60,6 +71,11 @@ class TestCacheStaticConfig {
 
 
 	use StaticConfigTrait;
 	use StaticConfigTrait;
 
 
+/**
+ * Cache driver class map.
+ *
+ * @return array
+ */
 	public static function getClassMap() {
 	public static function getClassMap() {
 		return [
 		return [
 			'apc' => 'Cake\Cache\Engine\ApcEngine',
 			'apc' => 'Cake\Cache\Engine\ApcEngine',
@@ -81,6 +97,11 @@ class TestEmailStaticConfig {
 
 
 	use StaticConfigTrait;
 	use StaticConfigTrait;
 
 
+/**
+ * Email driver class map.
+ *
+ * @return array
+ */
 	public static function getClassMap() {
 	public static function getClassMap() {
 		return [
 		return [
 			'debug' => 'Cake\Network\Email\DebugTransport',
 			'debug' => 'Cake\Network\Email\DebugTransport',
@@ -98,6 +119,11 @@ class TestLogStaticConfig {
 
 
 	use StaticConfigTrait;
 	use StaticConfigTrait;
 
 
+/**
+ * Log engine class map.
+ *
+ * @return array
+ */
 	public static function getClassMap() {
 	public static function getClassMap() {
 		return [
 		return [
 			'console' => 'Cake\Log\Engine\ConsoleLog',
 			'console' => 'Cake\Log\Engine\ConsoleLog',
@@ -114,11 +140,21 @@ class TestLogStaticConfig {
  */
  */
 class StaticConfigTraitTest extends TestCase {
 class StaticConfigTraitTest extends TestCase {
 
 
+/**
+ * setup method
+ *
+ * @return void
+ */
 	public function setUp() {
 	public function setUp() {
 		parent::setUp();
 		parent::setUp();
 		$this->subject = $this->getObjectForTrait('Cake\Core\StaticConfigTrait');
 		$this->subject = $this->getObjectForTrait('Cake\Core\StaticConfigTrait');
 	}
 	}
 
 
+/**
+ * teardown method
+ *
+ * @return void
+ */
 	public function tearDown() {
 	public function tearDown() {
 		unset($this->subject);
 		unset($this->subject);
 		parent::tearDown();
 		parent::tearDown();
@@ -130,9 +166,8 @@ class StaticConfigTraitTest extends TestCase {
  * @return void
  * @return void
  */
  */
 	public function testSimpleParseDsn() {
 	public function testSimpleParseDsn() {
-		$klassName = get_class($this->subject);
-
-		$this->assertSame([], $klassName::parseDsn(''));
+		$className = get_class($this->subject);
+		$this->assertSame([], $className::parseDsn(''));
 	}
 	}
 
 
 /**
 /**
@@ -142,8 +177,8 @@ class StaticConfigTraitTest extends TestCase {
  * @return void
  * @return void
  */
  */
 	public function testParseBadType() {
 	public function testParseBadType() {
-		$klassName = get_class($this->subject);
-		$klassName::parseDsn(['url' => 'http://:80']);
+		$className = get_class($this->subject);
+		$className::parseDsn(['url' => 'http://:80']);
 	}
 	}
 
 
 /**
 /**
@@ -385,4 +420,3 @@ class StaticConfigTraitTest extends TestCase {
 	}
 	}
 
 
 }
 }
-