#1
  1. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    3,014
    Rep Power
    175

    How can I debug this? Declaration of colorAxis::values($values) should be compatible


    Hi how can I debug this? Line 151 is the last } at the end of file! Might have something to do with my php version I guess.

    <p>Severity: Warning</p>
    <p>Message: Declaration of colorAxis::values($values) should be compatible with configOptions::values()</p>
    <p>Filename: configs/colorAxis.php</p>
    <p>Line Number: 151</p>
    Code:
    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    /**
     * colorAxis Object
     *
     * An object that specifies a mapping between color column values and colors
     * or a gradient scale.
     *
     *
     * @author Kevin Hill <kevinkhill@gmail.com>
     * @copyright (c) 2013, KHill Designs
     * @link https://github.com/kevinkhill/Codeigniter-gCharts GitHub Repository Page
     * @link http://kevinkhill.github.io/Codeigniter-gCharts/ GitHub Project Page
     * @license http://opensource.org/licenses/MIT MIT
     */
    
    class colorAxis extends configOptions
    {
        /**
         * Minimum value for chart color data.
         *
         * @var int
         */
        public $minValue = NULL;
    
        /**
         * Maximum value for chart color data.
         *
         * @var int
         */
        public $maxValue = NULL;
    
        /**
         * Controls how values are associated with colors.
         *
         * @var array
         */
        public $values = NULL;
    
        /**
         * Colors to assign to values in the visualization.
         *
         * @var array
         */
        public $colors = NULL;
    
    
        /**
         * Builds the colorAxis object with specified options
         *
         * @param array config
         * @return \colorAxis
         */
        public function __construct($config = array()) {
    
            $this->options = array(
                'minValue',
                'maxValue',
                'values',
                'colors'
            );
    
            parent::__construct($config);
        }
    
        /**
         * If present, specifies a minimum value for chart color data. Color data
         * values of this value and lower will be rendered as the first color in
         * the $this->colors range.
         *
         * @param numeric minValue
         * @return \colorAxis
         */
        public function minValue($minValue)
        {
            if(is_numeric($minValue))
            {
                $this->minValue = $minValue;
            } else {
                $this->type_error(__FUNCTION__, 'numeric');
            }
    
            return $this;
        }
    
        /**
         * If present, specifies a maximum value for chart color data. Color data
         * values of this value and higher will be rendered as the last color in
         * the $this->colors range.
         *
         * @param numeric maxValue
         * @return \colorAxis
         */
        public function maxValue($maxValue)
        {
            if(is_numeric($maxValue))
            {
                $this->maxValue = $maxValue;
            } else {
                $this->type_error(__FUNCTION__, 'numeric');
            }
    
            return $this;
        }
    
        /**
         * If present, controls how values are associated with colors. Each value
         * is associated with the corresponding color in the $this->colors array.
         * These values apply to the chart color data.
         *
         * Coloring is done according to a gradient of the values specified here.
         * Not specifying a value for this option is equivalent to specifying
         * [minValue, maxValue].
         *
         * @param array values
         * @return \colorAxis
         */
        public function values($values)
        {
            if(is_array($values) && array_values_check($values, 'numeric'))
            {
                $this->values = $values;
            } else {
                $this->type_error(__FUNCTION__, 'array', 'with values as [ int | float ]');
            }
            return $this;
        }
    
        /**
         * Colors to assign to values in the visualization. An array of strings,
         * where each element is an HTML color string.
         *
         * For example: $this->colors = array('red', '#004411')
         * You must have at least two values; the gradient will include all your
         * values, plus calculated intermediary values, with the first color as the
         * smallest value, and the last color as the highest.
         *
         * @param array colors
         * @return \colorAxis
         */
        public function colors($colors)
        {
            if(is_array($colors) && array_values_check($colors, 'string'))
            {
                $this->colors = $colors;
            } else {
                $this->type_error(__FUNCTION__, 'array', 'with values as strings');
            }
            return $this;
        }
    
    }
    
    /* End of file colorAxis.php */
    /* Location: ./gcharts/configs/colorAxis.php */
  2. #2
  3. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    15,973
    Rep Power
    9615
    "Debug it"? Read the error message:
    Declaration of colorAxis::values($values) should be compatible with configOptions::values()
    That means your version of the method
    PHP Code:
    public function values($values
    does not match the original method
    PHP Code:
    public function values() 
  4. #3
  5. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    3,014
    Rep Power
    175
    I only have this warning on my local computer. Online the same code is ok no warnings!
    Makes sense?
  6. #4
  7. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    15,973
    Rep Power
    9615
    You only see the warnings on your local computer.
  8. #5
  9. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    3,014
    Rep Power
    175
    hey Requinix;

    I know English Breakfast Tea is my username but English is not my first language. I know it's misleading.
    Please try to understand. Thank you very much!

    What I meant is that I don't see any warnings or errors when I deploy the site to on-line server and visit the page via Website Hosting - Mysite.com on world wide web.

    I see the warning on my local host MAMP PRO.

    Why do I get the errors locally? Is the anything special this error?
    Code:
    <p>Severity: Warning</p>
    <p>Message: Declaration of colorAxis::values($values) should be compatible with configOptions::values()</p>
    <p>Filename: configs/colorAxis.php</p>
    <p>Line Number: 151</p>
    Thank you very much
    Last edited by English Breakfast Tea; March 20th, 2017 at 02:06 AM.
  10. #6
  11. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    15,973
    Rep Power
    9615
    I put emphasis on the word "see" because that's the key: the warnings are there and you just are not seeing them. That's assuming you have the same versions of PHP (or close to) on both.

    Check your error_reporting and display_errors settings.

    I'm also not familiar with that formatted output so there's probably some sort of custom error handler involved.
  12. #7
  13. A Change of Season
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2004
    Location
    Next Door
    Posts
    3,014
    Rep Power
    175
    Hey

    The MAMP version on my laptop is different from what's on the server.

    How would you debug?
  14. #8
  15. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    15,973
    Rep Power
    9615
    Debug what? I explained what the error message meant last week: the code in your class is not compatible with the code in the parent class it is inheriting from. Your next step is to figure out a way to do what you want while keeping the method compatible.

IMN logo majestic logo threadwatch logo seochat tools logo