Skip to content

Commit

Permalink
fix up phpdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
mikegogulski committed Nov 25, 2010
1 parent 9bd3646 commit 191a6dd
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 8 deletions.
14 changes: 14 additions & 0 deletions .externalToolBuilders/New_Builder (1).launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${workspace}"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="bitcoin-php"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/bitcoin-php/build.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/bitcoin-php}"/>
</launchConfiguration>
10 changes: 10 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/New_Builder (1).launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
Expand Down
30 changes: 29 additions & 1 deletion src/bitcoin.inc
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<?php
/**
* Bitcoin classes
*
* Copyright (C) 2010 by Mike Gogulski - All rights reversed http://www.unlicense.org/ (public domain)
*
* @author Mike Gogulski - http://www.nostate.com/ http://www.gogulski.com/
* @author theymos - theymos @ http://bitcoin.org/smf
*/

define("BITCOIN_ADDRESS_VERSION", "00");// this is a hex byte
/**
* Bitcoin utility functions class
*
* @author theymos (functionality)
* @author Mike Gogulski (encapsulation, string abstraction, PHPDoc)
*/
Expand All @@ -18,6 +27,7 @@ class Bitcoin {

/**
* Convert a hex string into a (big) integer
*
* @param string $hex
* @return int
* @access private
Expand All @@ -35,6 +45,7 @@ class Bitcoin {

/**
* Convert an integer into a hex string
*
* @param int $dec
* @return string
* @access private
Expand All @@ -52,6 +63,7 @@ class Bitcoin {

/**
* Convert a Base58-encoded integer into the equivalent hex string representation
*
* @param string $base58
* @return string
* @access private
Expand Down Expand Up @@ -82,6 +94,7 @@ class Bitcoin {

/**
* Convert a hex string representation of an integer into the equivalent Base58 representation
*
* @param string $hex
* @return string
* @access private
Expand Down Expand Up @@ -112,6 +125,7 @@ class Bitcoin {

/**
* Convert a 160-bit Bitcoin hash to a Bitcoin address
*
* @author theymos
* @param string $hash160
* @param string $addressversion
Expand All @@ -129,6 +143,7 @@ class Bitcoin {

/**
* Convert a Bitcoin address to a 160-bit Bitcoin hash
*
* @author theymos
* @param string $addr
* @return string Bitcoin hash
Expand All @@ -142,6 +157,7 @@ class Bitcoin {

/**
* Determine if a string is a valid Bitcoin address
*
* @author theymos
* @param string $addr String to test
* @param string $addressversion
Expand All @@ -166,6 +182,7 @@ class Bitcoin {

/**
* Convert the input to its 160-bit Bitcoin hash
*
* @param string $data
* @return string
* @access private
Expand All @@ -177,6 +194,7 @@ class Bitcoin {

/**
* Convert a Bitcoin public key to a 160-bit Bitcoin hash
*
* @param string $pubkey
* @return string
* @access public
Expand All @@ -187,6 +205,7 @@ class Bitcoin {

/**
* Remove leading "0x" from a hex value if present.
*
* @param string $string
* @return string
* @access public
Expand All @@ -199,8 +218,13 @@ class Bitcoin {
}
}

/**
* Exception class for BitcoinClient
* @author Mike Gogulski
*
*/
class BitcoinClientException extends ErrorException {
// Redefine the exception so message and severity aren't optional
// Redefine the exception so message isn't optional
public function __construct($message, $code = 0, $severity = E_USER_NOTICE, Exception $previous = null) {
parent::__construct($message, $code, $severity, $previous);
}
Expand All @@ -221,6 +245,7 @@ class BitcoinClient extends jsonrpc_client {

/**
* Create a jsonrpc_client object to talk to the bitcoin server and return it, or false on failure.
*
* @param string $scheme "http" or "https"
* @param string $username User name to use in connection the Bitcoin server's JSON-RPC interface
* @param string $password Server password
Expand Down Expand Up @@ -260,6 +285,7 @@ class BitcoinClient extends jsonrpc_client {
* Test if the connection to the Bitcoin JSON-RPC server is working
*
* The check is done by calling the server's getinfo() method and checking for a fault.
*
* @return mixed boolean TRUE if successful, cURL fault string otherwise
* @access public
* @throws none
Expand All @@ -275,6 +301,7 @@ class BitcoinClient extends jsonrpc_client {

/**
* Convert a Bitcoin server query argument to a jsonrpcval
*
* @param mixed $a
* @return jsonrpcval
* @throws none
Expand Down Expand Up @@ -303,6 +330,7 @@ class BitcoinClient extends jsonrpc_client {

/**
* Send a JSON-RPC message and optional parameter arguments to the server
*
* @param string $message
* @param mixed $args,...
* @return mixed
Expand Down
8 changes: 4 additions & 4 deletions src/tests/BitcoinClientTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ require_once dirname(__FILE__) . '/../bitcoin.inc';

/**
* Test class for BitcoinClient.
* @author Mike Gogulski
*
* Copyright (C) 2010 by Mike Gogulski - All rights reversed http://www.unlicense.org/ (public domain)
*
* @author Mike Gogulski - http://www.nostate.com/ http://www.gogulski.com/
*/
class BitcoinClientTest extends PHPUnit_Framework_TestCase {
/**
* @var BitcoinClient
*/
protected $invalidScheme;
protected $noUsername;
protected $noPassword;
Expand Down
9 changes: 6 additions & 3 deletions src/tests/BitcoinTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ require_once dirname(__FILE__) . '/../bitcoin.inc';

/**
* Test class for Bitcoin.
* @author Mike Gogulski
*
* Copyright (C) 2010 by Mike Gogulski - All rights reversed http://www.unlicense.org/ (public domain)
*
* @author Mike Gogulski - http://www.nostate.com/ http://www.gogulski.com/
*/
class BitcoinTest extends PHPUnit_Framework_TestCase {
protected function setUp() {
Expand All @@ -30,7 +33,7 @@ class BitcoinTest extends PHPUnit_Framework_TestCase {
}

/**
* @todo Implement testCheckAddress().
* Test Bitcoin::checkAddress() with various good and bad addresses.
*/
public function testCheckAddress() {
$this->assertTrue(TRUE);
Expand All @@ -51,7 +54,7 @@ class BitcoinTest extends PHPUnit_Framework_TestCase {
}

/**
* @todo Implement testRemove0x().
* Test the Bitcoin::remove0x() function.
*/
public function testRemove0x() {
$this->assertEquals(Bitcoin::remove0x("abcdefg"), "abcdefg");
Expand Down

1 comment on commit 191a6dd

@BitLits2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to create this new website please email: Saveamillion7@gmail.com

Please sign in to comment.