Get depth

If no "depth" value has been set, this method will
set and return a default "depth" value,
if any such value is available

@see getDefaultDepth()

@return int|null depth or null if no depth has been set
552892
public function getDepth() : ?int 
    {
        if ( ! $this->hasDepth()) {
            $this->setDepth($this->getDefaultDepth());
        }
        return $this->depth;
    }
1227474
protected int getDepth() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getDepth");

    int depth;

    synchronized (barrier) {
       depth = queue.size();
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getDepth", depth);
    return depth;
  }
961203
public function getLdapValue()
    {
        if ($this->never) {
            $value = self::NEVER;
        } else {
            $total = 0;
            foreach (self::UNIT as $unit => $conversion) {
                $total += $this->$unit * $conversion;
            }
            $value = number_format($total, 0, '.', '');
        }

        return $value;
    }
902643
public function getDefaultValue()
    {
        if (!$this->hasDefaultValue()) {
            return null;
        }

        if ($this->defaultValue instanceof FragmentInterface) {
            //Defined as SQL piece
            return $this->defaultValue;
        }

        if (in_array($this->getAbstractType(), ['time', 'date', 'datetime', 'timestamp'])) {
            return $this->formatDatetime($this->getAbstractType(), $this->defaultValue);
        }

        switch ($this->getType()) {
            case 'int':
                return (int)$this->defaultValue;
            case 'float':
                return (float)$this->defaultValue;
            case 'bool':
                if (is_string($this->defaultValue) && strtolower($this->defaultValue) == 'false') {
                    return false;
                }

                return (bool)$this->defaultValue;
        }

        return (string)$this->defaultValue;
    }
28130
public function getDefaultLabel()
    {
        $oDefault = $this->getDefault();
        return empty($oDefault->label) ? false : $oDefault->label;
    }
263200
public function getInitialValue()
    {
        if ($this->hasDefaultValue) {
            return $this->defaultValue;
        }

        return $this->isNullable ? null : $this->dataType->getInitialValue();
    }
767850
public function getValue() : ?string 
    {
        if ( ! $this->hasValue()) {
            $this->setValue($this->getDefaultValue());
        }
        return $this->value;
    }
441369
public function getDepthToOriginalContainer() {
		$depth = 0;
		$ancestry = $this->getAncestry();
		foreach ($ancestry as $a) {
			$ancestor = get_entity($a);
			if ($ancestor instanceof self) {
				$depth++;
			}
		}
		return $depth;
	}
695589
public function getDefault() {
    	if ($this->isPublic() && !$this->isStatic() && $this->refClass->isAbstract() == false) {	    		 
	  		$className = $this->refClass->getName();
	  		// TODO: find a way to get default value for abstract properties.
	  		// TODO: optimize this: we should not have to create one new instance for every property....
	  		/*$instance = new $className();
			$property = $this->getName();
	    	return $instance->$property;*/
	  		
	  		// In some cases, the call to getDefaultProperties can log NOTICES
	  		// in particular if an undefined constant is used as default value.
	  		ob_start();
	  		$defaultProperties = $this->refClass->getDefaultProperties();
	  		$possibleError = ob_get_clean();
			if ($possibleError) {
				throw new \Exception($possibleError);	
			}
	  		return $defaultProperties[$this->getName()];
    	} else {
    		return null;
    	}
    }
397281
public function getDepthAttribute()
    {
        $category = $this;

        return $this->remember('depth', function () use ($category) {
            $depth = 0;

            while ($category->parent) {
                $depth++;
                $category = $category->parent;
            }

            return $depth;
        });
    }
224277
public function getDefaultParent()
    {
        if ($defaultParents = $this->config()->default_parents) {
            
            if (isset($defaultParents[$this->getClass()])) {
                
                $result = $this->processValue($defaultParents[$this->getClass()]);
                
                if ($result instanceof DataObject) {
                    return $result->ID;
                }
                
                return $result;
                
            }
            
        }
    }
507940
protected function getNewRealDepth($ancestor)
    {
        if (!$ancestor instanceof EntityInterface) {
            if (is_null($ancestor)) {
                return 0;
            } else {
                return static::find($ancestor)->real_depth + 1;
            }
        } else {
            return $ancestor->real_depth + 1;
        }
    }
147582
public function getDefaultTheme()
    {
        if (!$this->_defaultTheme) {
            $keys = $this->keys(); /// shame to PHP it can't be done in single line :(
            $this->_defaultTheme = reset($keys);
        }

        return $this->_defaultTheme;
    }
738303
public function getIndex() : ?int 
    {
        if ( ! $this->hasIndex()) {
            $this->setIndex($this->getDefaultIndex());
        }
        return $this->index;
    }
1125566
public function getDefaultMonth()
    {
        $result = null;

        $keys = array_keys($this->getMonths());
        if (count($keys) >= 2) {
            $result = (string)$keys[1];
        }

        return $result;
    }
1162446
function getCurrentStackItem() {
		$topItem = end($this->statements);

		if (!empty($topItem)) {
			return $topItem;
		} else {
			// In case of a empty stack, we are at the root of a PHP file (with no class or function).
			// We return the default values
			return $this->getDefaultItem();
		}
	}
956031
public function getDepth()
    {
        return array_reduce(
            $this->cartLines->toArray(),
            function ($depth, CartLineInterface $cartLine) {
                return max($depth, $cartLine->getDepth());
            },
            0
        );
    }